[PATCH kvmtool 3/3] net/dhcp: avoid misleading strncpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <andre.przywara@xxxxxxx>
---
 net/uip/dhcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/uip/dhcp.c b/net/uip/dhcp.c
index 8f013002..9de5588b 100644
--- a/net/uip/dhcp.c
+++ b/net/uip/dhcp.c
@@ -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);
-- 
2.17.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux