Commit 634b215b authored by XueBing Chen's avatar XueBing Chen Committed by David S. Miller

net: ipconfig: use strscpy to replace strlcpy

The strlcpy should not be used because it doesn't limit the source
length. Preferred is strscpy.
Signed-off-by: default avatarXueBing Chen <chenxuebing@jari.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 798661c7
...@@ -1759,15 +1759,15 @@ static int __init ip_auto_config_setup(char *addrs) ...@@ -1759,15 +1759,15 @@ static int __init ip_auto_config_setup(char *addrs)
case 4: case 4:
if ((dp = strchr(ip, '.'))) { if ((dp = strchr(ip, '.'))) {
*dp++ = '\0'; *dp++ = '\0';
strlcpy(utsname()->domainname, dp, strscpy(utsname()->domainname, dp,
sizeof(utsname()->domainname)); sizeof(utsname()->domainname));
} }
strlcpy(utsname()->nodename, ip, strscpy(utsname()->nodename, ip,
sizeof(utsname()->nodename)); sizeof(utsname()->nodename));
ic_host_name_set = 1; ic_host_name_set = 1;
break; break;
case 5: case 5:
strlcpy(user_dev_name, ip, sizeof(user_dev_name)); strscpy(user_dev_name, ip, sizeof(user_dev_name));
break; break;
case 6: case 6:
if (ic_proto_name(ip) == 0 && if (ic_proto_name(ip) == 0 &&
...@@ -1814,7 +1814,7 @@ __setup("nfsaddrs=", nfsaddrs_config_setup); ...@@ -1814,7 +1814,7 @@ __setup("nfsaddrs=", nfsaddrs_config_setup);
static int __init vendor_class_identifier_setup(char *addrs) static int __init vendor_class_identifier_setup(char *addrs)
{ {
if (strlcpy(vendor_class_identifier, addrs, if (strscpy(vendor_class_identifier, addrs,
sizeof(vendor_class_identifier)) sizeof(vendor_class_identifier))
>= sizeof(vendor_class_identifier)) >= sizeof(vendor_class_identifier))
pr_warn("DHCP: vendorclass too long, truncated to \"%s\"\n", pr_warn("DHCP: vendorclass too long, truncated to \"%s\"\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment