will be in the maintainance mode on Wednesday June 29th 01:00 - 10:00 (UTC+1). Repositories is read only during the maintainance.

Commit 0796825e authored by Andre Przywara's avatar Andre Przywara Committed by Will Deacon
Browse files

net/dhcp: avoid misleading strncpy

The code for copying an empty IP address into the DHCP opt buffer used
strncpy, however used the source length as the size argument. GCC 8.x
complains about it.

Since the source string is actually fixed, just revert to the old
strcpy, which gives us actually the same level of security in this case,
but makes the compiler happy.
Signed-off-by: Andre Przywara's avatarAndre Przywara <>
Signed-off-by: default avatarWill Deacon <>
parent 05755b29
......@@ -131,7 +131,7 @@ static int uip_dhcp_fill_option(struct uip_info *info, struct uip_dhcp *dhcp, in
opt[i++] = UIP_DHCP_TAG_ROOT;
opt[i++] = strlen(EMPTY_ADDR);
addr = (u32 *)&opt[i];
strncpy((void *) addr, EMPTY_ADDR, strlen(EMPTY_ADDR));
strcpy((void *) addr, EMPTY_ADDR);
i += strlen(EMPTY_ADDR);
i = uip_dhcp_fill_option_name_and_server(info, opt, i);
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