summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump/print-sunrpc.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-11-07 18:48:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-11-07 18:48:17 +0000
commit40916825fffc2d230ff71223ec549d8adcd12e3a (patch)
treeb0713d85cff765331757cecd00927d53f0a0e974 /usr.sbin/tcpdump/print-sunrpc.c
parent62feb498dfb5f762dd9a7b26eddd2acbf9996682 (diff)
simplify buffer handling; ok ho
Diffstat (limited to 'usr.sbin/tcpdump/print-sunrpc.c')
-rw-r--r--usr.sbin/tcpdump/print-sunrpc.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.sbin/tcpdump/print-sunrpc.c b/usr.sbin/tcpdump/print-sunrpc.c
index 859f72c3eeb..51a539ad401 100644
--- a/usr.sbin/tcpdump/print-sunrpc.c
+++ b/usr.sbin/tcpdump/print-sunrpc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-sunrpc.c,v 1.11 2001/11/06 03:11:40 deraadt Exp $ */
+/* $OpenBSD: print-sunrpc.c,v 1.12 2001/11/07 18:48:16 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-sunrpc.c,v 1.11 2001/11/06 03:11:40 deraadt Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-sunrpc.c,v 1.12 2001/11/07 18:48:16 deraadt Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -115,10 +115,8 @@ progstr(prog)
return (buf);
rp = getrpcbynumber(prog);
if (rp == NULL)
- (void) snprintf(buf, sizeof(buf), "#%u", prog);
- else {
- strncpy(buf, rp->r_name, sizeof buf-1);
- buf[sizeof buf-1] = '\0';
- }
+ snprintf(buf, sizeof(buf), "#%u", prog);
+ else
+ strlcpy(buf, rp->r_name, sizeof(buf));
return (buf);
}