diff options
author | kris <kris@FreeBSD.org> | 2000-10-05 02:49:49 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2000-10-05 02:49:49 +0000 |
commit | 0e6572e8c926177cef3761baf9d239b9e9fcd284 (patch) | |
tree | 272e6ba0729da219ce1b5874a9a588104608fee5 /contrib/tcpdump/print-sunrpc.c | |
parent | 7790e4029528c008ed9548e6cd9cbc55f6d22c61 (diff) | |
download | FreeBSD-src-0e6572e8c926177cef3761baf9d239b9e9fcd284.zip FreeBSD-src-0e6572e8c926177cef3761baf9d239b9e9fcd284.tar.gz |
* Buffer-safe string function cleanup. There are a couple of strcpy()
and strcat()s which would be more difficult to fix, but I think they're
safe anyway.
* Don't crash at runtime by overflowing a buffer with constant data in
print-icmp.c on a long hostname.
* Don't overflow a static buffer by trying to decode an AFS ACL into a buffer
which is way too small for it.
Reviewed by: -audit
Diffstat (limited to 'contrib/tcpdump/print-sunrpc.c')
-rw-r--r-- | contrib/tcpdump/print-sunrpc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/tcpdump/print-sunrpc.c b/contrib/tcpdump/print-sunrpc.c index 54dcf66..ddac913 100644 --- a/contrib/tcpdump/print-sunrpc.c +++ b/contrib/tcpdump/print-sunrpc.c @@ -132,7 +132,9 @@ progstr(prog) rp = getrpcbynumber(prog); if (rp == NULL) (void) sprintf(buf, "#%u", prog); - else - strcpy(buf, rp->r_name); + else { + strncpy(buf, rp->r_name, sizeof(buf)-1); + buf[sizeof(buf)-1] = '\0'; + } return (buf); } |