summaryrefslogtreecommitdiffstats
path: root/usr.bin/killall
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2008-11-19 00:14:15 +0000
committerdelphij <delphij@FreeBSD.org>2008-11-19 00:14:15 +0000
commit852f970889dae6451bf8234efca9a2f4feb19d4a (patch)
tree8e9a9560b0ab5c6172c9c670b93cb2fe457b2797 /usr.bin/killall
parent49f1cb9c3aa848254bb719646c93aeeb02b393f0 (diff)
downloadFreeBSD-src-852f970889dae6451bf8234efca9a2f4feb19d4a.zip
FreeBSD-src-852f970889dae6451bf8234efca9a2f4feb19d4a.tar.gz
Use strlcpy() where appropriate.
Diffstat (limited to 'usr.bin/killall')
-rw-r--r--usr.bin/killall/killall.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c
index b991b15..8e84572 100644
--- a/usr.bin/killall/killall.c
+++ b/usr.bin/killall/killall.c
@@ -64,8 +64,7 @@ upper(const char *str)
static char buf[80];
char *s;
- strncpy(buf, str, sizeof(buf));
- buf[sizeof(buf) - 1] = '\0';
+ strlcpy(buf, str, sizeof(buf));
for (s = buf; *s; s++)
*s = toupper((unsigned char)*s);
return buf;
@@ -327,8 +326,7 @@ main(int ac, char **av)
if ((procs[i].ki_stat & SZOMB) == SZOMB && !zflag)
continue;
thispid = procs[i].ki_pid;
- strncpy(thiscmd, procs[i].ki_comm, MAXCOMLEN);
- thiscmd[MAXCOMLEN] = '\0';
+ strlcpy(thiscmd, procs[i].ki_comm, sizeof(thiscmd));
thistdev = procs[i].ki_tdev;
if (eflag)
thisuid = procs[i].ki_uid; /* effective uid */
OpenPOWER on IntegriCloud