From 6e229b2973123c51b528d7553bd25369c36b0ac5 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 14 May 2016 20:58:34 +0000 Subject: [PATCH] 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 --- usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c index de5a60b3022b..2d3099e04f02 100644 --- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c +++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c @@ -774,7 +774,7 @@ snmp_import_object(struct snmp_toolinfo *snmptoolctx) return (-1); } - strlcpy(string, nexttok, strlen(nexttok) + 1); + strlcpy(string, nexttok, nitems(string)); oid2str->string = string; oid2str->strlen = strlen(nexttok);