]> The Tcpdump Group git mirrors - tcpdump/commitdiff
strncpy() does not ensure string termination.
authoritojun <itojun>
Sat, 10 Jun 2000 05:26:42 +0000 (05:26 +0000)
committeritojun <itojun>
Sat, 10 Jun 2000 05:26:42 +0000 (05:26 +0000)
print-nfs.c

index aad743ba600f41b254383b103b1c0c543b8c63ae..2ba2d47dfabcb51055079cce36c5cf609dbfbb2b 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.75 2000-06-10 05:23:19 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.76 2000-06-10 05:26:42 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -718,6 +718,7 @@ nfs_printfh(register const u_int32_t *dp, const u_int len)
 
                /* Make sure string is null-terminated */
                strncpy(temp, sfsname, NFSX_V3FHMAX);
+               temp[sizeof(temp) - 1] = '\0';
                /* Remove trailing spaces */
                sfsname = strchr(temp, ' ');
                if (sfsname)