Skip to content

Commit 56ccc4e

Browse files
fix: V-001 security vulnerability
Automated security fix generated by Orbis Security AI
1 parent 94df46c commit 56ccc4e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

components/net/lwip-dhcpd/dhcp_server_raw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ dhcp_client_alloc(struct dhcp_server *dhcpserver, struct dhcp_msg *msg,
266266
{
267267
return NULL;
268268
}
269-
SMEMCPY(node->chaddr, msg->chaddr, msg->hlen);
269+
SMEMCPY(node->chaddr, msg->chaddr, (msg->hlen > sizeof(node->chaddr)) ? sizeof(node->chaddr) : msg->hlen);
270270
node->ipaddr = dhcpserver->current;
271271

272272
node->next = dhcpserver->node_list;
@@ -731,10 +731,10 @@ void dhcpd_start(const char *netif_name)
731731
}
732732
p = p + 1; /* move to xxx.xxx.xxx.^ */
733733

734-
sprintf(p, "%d", DHCPD_CLIENT_IP_MIN);
734+
snprintf(p, (size_t)(str_tmp + sizeof(str_tmp) - p), "%d", DHCPD_CLIENT_IP_MIN);
735735
ip4addr_aton(str_tmp, &ip_start);
736736
DEBUG_PRINTF("ip_start: [%s]\r\n", str_tmp);
737-
sprintf(p, "%d", DHCPD_CLIENT_IP_MAX);
737+
snprintf(p, (size_t)(str_tmp + sizeof(str_tmp) - p), "%d", DHCPD_CLIENT_IP_MAX);
738738
ip4addr_aton(str_tmp, &ip_end);
739739
DEBUG_PRINTF("ip_end: [%s]\r\n", str_tmp);
740740

0 commit comments

Comments
 (0)