diff --git a/bin/systrace/systrace-translate.c b/bin/systrace/systrace-translate.c index 6ee53e660131..b8feac04414a 100644 --- a/bin/systrace/systrace-translate.c +++ b/bin/systrace/systrace-translate.c @@ -1,4 +1,4 @@ -/* $NetBSD: systrace-translate.c,v 1.15 2005/06/25 14:37:33 christos Exp $ */ +/* $NetBSD: systrace-translate.c,v 1.16 2005/06/25 18:47:42 elad Exp $ */ /* $OpenBSD: systrace-translate.c,v 1.10 2002/08/01 20:50:17 provos Exp $ */ /* * Copyright 2002 Niels Provos @@ -274,7 +274,7 @@ print_uname(char *buf, size_t buflen, struct intercept_translate *tl) uid_t uid = (intptr_t)tl->trans_addr; pw = getpwuid(uid); - snprintf(buf, buflen, "%s", pw != NULL ? pw->pw_name : ""); + strlcpy(buf, pw != NULL ? pw->pw_name : "", buflen); return (0); } @@ -287,8 +287,8 @@ print_pidname(char *buf, size_t buflen, struct intercept_translate *tl) if (pid != 0) { icpid = intercept_getpid(pid); - snprintf(buf, buflen, "%s", - icpid->name != NULL ? icpid->name : ""); + strlcpy(buf, icpid->name != NULL ? icpid->name + : "", buflen); if (icpid->name == NULL) intercept_freepid(pid); } else @@ -387,7 +387,7 @@ print_signame(char *buf, size_t buflen, struct intercept_translate *tl) return (0); } - snprintf(buf, buflen, "%s", name); + strlcpy(buf, name, buflen); return (0); } @@ -430,7 +430,7 @@ print_fcntlcmd(char *buf, size_t buflen, struct intercept_translate *tl) return (0); } - snprintf(buf, buflen, "%s", name); + strlcpy(buf, name, buflen); return (0); } @@ -526,7 +526,7 @@ get_argv(struct intercept_translate *trans, int fd, pid_t pid, void *addr) static int print_argv(char *buf, size_t buflen, struct intercept_translate *tl) { - snprintf(buf, buflen, "%s", (char *)tl->trans_data); + strlcpy(buf, (char *)tl->trans_data, buflen); return (0); } diff --git a/bin/systrace/systrace.c b/bin/systrace/systrace.c index cb876c2afa6e..773eeef582ec 100644 --- a/bin/systrace/systrace.c +++ b/bin/systrace/systrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: systrace.c,v 1.30 2005/06/24 23:21:09 christos Exp $ */ +/* $NetBSD: systrace.c,v 1.31 2005/06/25 18:47:42 elad Exp $ */ /* $OpenBSD: systrace.c,v 1.32 2002/08/05 23:27:53 provos Exp $ */ /* * Copyright 2002 Niels Provos @@ -87,7 +87,7 @@ systrace_parameters(void) if ((pw = getpwuid(uid)) == NULL) snprintf(username, sizeof(username), "uid %u", uid); else - snprintf(username, sizeof(username), "%s", pw->pw_name); + strlcpy(username, pw->pw_name, sizeof(username)); strlcpy(home, pw->pw_dir, sizeof(home));