Skip to content
Snippets Groups Projects
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 <andre.przywara@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 05755b29
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment