diff options
author | 2005-05-03 18:03:26 +0000 | |
---|---|---|
committer | 2005-05-03 18:03:26 +0000 | |
commit | a1d85c9f81ba60007adacf8086d1b0f4fb329fb0 (patch) | |
tree | 715458b936542bbeffca092bf2dcfd515f90c9f5 | |
parent | typo, automaticaly -> automatically (diff) | |
download | wireguard-openbsd-a1d85c9f81ba60007adacf8086d1b0f4fb329fb0.tar.xz wireguard-openbsd-a1d85c9f81ba60007adacf8086d1b0f4fb329fb0.zip |
some snprintf() -> strlcpy to improve readibility (and speed?)
from rohee@, ok millert@ before 3.7
-rw-r--r-- | bin/systrace/systrace-translate.c | 12 | ||||
-rw-r--r-- | bin/systrace/systrace.c | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/bin/systrace/systrace-translate.c b/bin/systrace/systrace-translate.c index a40291b5ebe..870bc33b98f 100644 --- a/bin/systrace/systrace-translate.c +++ b/bin/systrace/systrace-translate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: systrace-translate.c,v 1.17 2003/07/19 11:48:58 sturm Exp $ */ +/* $OpenBSD: systrace-translate.c,v 1.18 2005/05/03 18:03:26 sturm Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -251,7 +251,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 : "<unknown>"); + strlcpy(buf, pw != NULL ? pw->pw_name : "<unknown>", buflen); return (0); } @@ -264,8 +264,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 : "<unknown>"); + strlcpy(buf, icpid->name != NULL ? icpid->name : "<unknown>", + buflen); if (icpid->name == NULL) intercept_freepid(pid); } else @@ -366,7 +366,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); } @@ -416,7 +416,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 358b2764b4b..14c2bca91c4 100644 --- a/bin/systrace/systrace.c +++ b/bin/systrace/systrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: systrace.c,v 1.49 2004/01/23 20:51:18 sturm Exp $ */ +/* $OpenBSD: systrace.c,v 1.50 2005/05/03 18:03:26 sturm Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -90,7 +90,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)); |