← Commit list

fd1972099

Denys Vlasenko
Denys Vlasenko
2026-09-21
SUCCESS Duration: 219s

Subject

udhcpc: ensure packet.data.cookie exists before we access it

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

networking/udhcp/dhcpc.c+7 -2
@@ -900,7 +900,12 @@ static NOINLINE int d4_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
break;
}
- if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp))) {
+ if (bytes < (int) (
+ sizeof(packet.ip) + sizeof(packet.udp)
+ + offsetof(struct dhcp_packet, options)
+ /* DHCP requires option 255 is always present, IOW: at least one byte in options[]: */
+ + 1
+ )) {
log1s("packet is too short, ignoring");
return -2;
}
@@ -954,7 +959,7 @@ static NOINLINE int d4_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
packet.ip.tot_len = packet.udp.len; /* yes, this is needed */
check = packet.udp.check;
packet.udp.check = 0;
- if (check && check != inet_cksum(&packet, bytes)) {
+ if (check != 0 && check != inet_cksum(&packet, bytes)) {
log1s("packet with bad UDP checksum, ignoring");
return -2;
}