Closed
Description
The code below misses a check on the relationship between packetlen and bodylen before Line 298, which may lead to buffer overflows when accessing the memory at Line 300 and Line 309.
Lines 289 to 309 in 3d1ff4b
To fix, we may put the code below before the while loop:
if (packetlen < bodylen + 4) {
debugf(BABEL_DEBUG_COMMON,"Received truncated message.");
return 1;
}
The output of the address sanitizer:
==271648==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000000114 at pc 0x00000059301a bp 0x7fff3f7301f0 sp 0x7fff3f7301e8
READ of size 1 at 0x603000000114 thread T0
#0 0x593019 in babel_packet_examin /home/parallels/myfrr/babeld/message.c:300:16
#1 0x593019 in parse_packet /home/parallels/myfrr/babeld/message.c:354:9
Metadata
Metadata
Assignees
Labels
No labels