Author: ngie
Date: Sat May 14 22:40:35 2016
New Revision: 299769
URL: https://svnweb.freebsd.org/changeset/base/299769

Log:
  Use the size of the destination buffer instead of the malloc size, repeated, 
in order
  to mute a -Wstrlcpy-strlcat-size warning
  
  MFC after: 1 week
  Reported by: clang
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
==============================================================================
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Sat May 14 22:40:08 
2016        (r299768)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Sat May 14 22:40:35 
2016        (r299769)
@@ -282,7 +282,7 @@ enum_pair_insert(struct enum_pairs *head
        }
 
        e_new->enum_val = enum_val;
-       strlcpy(e_new->enum_str, enum_str, strlen(enum_str) + 1);
+       strlcpy(e_new->enum_str, enum_str, nitems(e_new->enum_str));
        STAILQ_INSERT_TAIL(headp, e_new, link);
 
        return (1);
@@ -568,7 +568,7 @@ snmp_enumtc_init(char *name)
                free(enum_tc);
                return (NULL);
        }
-       strlcpy(enum_tc->name, name, strlen(name) + 1);
+       strlcpy(enum_tc->name, name, nitems(enum_tc->name));
 
        return (enum_tc);
 }
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to