summaryrefslogtreecommitdiff
path: root/bin/systrace
diff options
context:
space:
mode:
authorNikolay Sturm <sturm@cvs.openbsd.org>2005-05-03 18:03:27 +0000
committerNikolay Sturm <sturm@cvs.openbsd.org>2005-05-03 18:03:27 +0000
commit7c044e9661f68aeae7ce2dc089ae43b225b906c6 (patch)
tree8927804415f0b563ea749a58d7af3187b5a91f0a /bin/systrace
parent7d5efb47ae9253ac3d54f6a0c2323d0d8344c32d (diff)
some snprintf() -> strlcpy to improve readibility (and speed?)
from rohee@, ok millert@ before 3.7
Diffstat (limited to 'bin/systrace')
-rw-r--r--bin/systrace/systrace-translate.c12
-rw-r--r--bin/systrace/systrace.c4
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));