]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - lib/inet_proto.c
Include bsd/string.h only in include/utils.h
[mirror_iproute2.git] / lib / inet_proto.c
index 53c029039b6d5f56a9506db2f690e920bb5e97c9..0836a4c96a0b486ef9e82f5a9d5eddcd27a23ae1 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <syslog.h>
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -38,8 +37,7 @@ const char *inet_proto_n2a(int proto, char *buf, int len)
                        free(ncache);
                icache = proto;
                ncache = strdup(pe->p_name);
-               strncpy(buf, pe->p_name, len - 1);
-               buf[len - 1] = '\0';
+               strlcpy(buf, pe->p_name, len);
                return buf;
        }
        snprintf(buf, len, "ipproto-%d", proto);