svn commit: r295187 - user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools

Garrett Cooper ngie at FreeBSD.org
Wed Feb 3 01:58:39 UTC 2016


Author: ngie
Date: Wed Feb  3 01:58:37 2016
New Revision: 295187
URL: https://svnweb.freebsd.org/changeset/base/295187

Log:
  Use nitems(string) instead of strlen(nexttok) + 1 to mute a valid
  security concern with strlcpy related to the source/destination
  buffer sizes (-Wstrlcpy-strlcat-size)
  
  Reported by: Jenkins (clang job)
  Sponsored by: EMC / Isilon Storage Division

Modified:
  user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c

Modified: user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c
==============================================================================
--- user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c	Wed Feb  3 01:50:27 2016	(r295186)
+++ user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c	Wed Feb  3 01:58:37 2016	(r295187)
@@ -775,7 +775,7 @@ snmp_import_object(struct snmp_toolinfo 
 	}
 
 	memset(oid2str, 0, sizeof(struct snmp_oid2str));
-	strlcpy(string, nexttok, strlen(nexttok) + 1);
+	strlcpy(string, nexttok, nitems(string));
 	oid2str->string = string;
 	oid2str->strlen = strlen(nexttok);
 


More information about the svn-src-user mailing list