summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat/pigs.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1998-06-09 04:17:29 +0000
committerimp <imp@FreeBSD.org>1998-06-09 04:17:29 +0000
commita51cfac66561e49404427c1f83558e065a044bd9 (patch)
treeef4c907c3868bfdb4e37e3f7fe334916bf2132a0 /usr.bin/systat/pigs.c
parent94f67b7ef56a6df8d3c217cd5cc00b14f2dc3ae2 (diff)
downloadFreeBSD-src-a51cfac66561e49404427c1f83558e065a044bd9.zip
FreeBSD-src-a51cfac66561e49404427c1f83558e065a044bd9.tar.gz
o Use snprintf rather than sprintf
o Add more checks for buffer overflows o Use snprintf rather than strcat/cpy and have better checks for max length exceeded. Most of these changes are not exploitable buffer overruns, but it never hurts to be safe. Inspired by and obtained from: OpenBSD
Diffstat (limited to 'usr.bin/systat/pigs.c')
-rw-r--r--usr.bin/systat/pigs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c
index f637a63..e14d3eb 100644
--- a/usr.bin/systat/pigs.c
+++ b/usr.bin/systat/pigs.c
@@ -125,7 +125,7 @@ showpigs()
wmove(wnd, y, 0);
wclrtoeol(wnd);
mvwaddstr(wnd, y, 0, uname);
- sprintf(pidname, "%10.10s", pname);
+ snprintf(pidname, sizeof(pidname), "%10.10s", pname);
mvwaddstr(wnd, y, 9, pidname);
wmove(wnd, y, 20);
for (j = pt[k].pt_pctcpu*factor + 0.5; j > 0; j--)
OpenPOWER on IntegriCloud