Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 May 2016 20:58:34 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299763 - head/usr.sbin/bsnmpd/tools/libbsnmptools
Message-ID:  <201605142058.u4EKwYK3037139@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605142058.u4EKwYK3037139>