svn commit: r299763 - head/usr.sbin/bsnmpd/tools/libbsnmptools

Garrett Cooper ngie at FreeBSD.org
Sat May 14 20:58:35 UTC 2016


Author: ngie
Date: Sat May 14 20:58:34 2016
New Revision: 299763
URL: https://svnweb.freebsd.org/changeset/base/299763

Log:
  Mute -Wstrlcpy-strlcat-size warning by using nitems with the size of the buffer
  
  This is a no-op as the malloc above set the size of the buffer to the size used
  below, but this keeps things consistent in case the malloc call changes somehow.
  
  MFC after: 1 week
  Reported by: clang
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c
==============================================================================
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c	Sat May 14 20:33:42 2016	(r299762)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c	Sat May 14 20:58:34 2016	(r299763)
@@ -774,7 +774,7 @@ snmp_import_object(struct snmp_toolinfo 
 		return (-1);
 	}
 
-	strlcpy(string, nexttok, strlen(nexttok) + 1);
+	strlcpy(string, nexttok, nitems(string));
 	oid2str->string = string;
 	oid2str->strlen = strlen(nexttok);
 


More information about the svn-src-all mailing list