mirror / busybox

BusyBox mirror
https://www.busybox.net/
Other
1.64k stars 617 forks source link

Buffer Overflow: Off-by-One in scripts/basic/split-include.c:198 #52

Open saurabhuja opened 2 years ago

saurabhuja commented 2 years ago

Refer https://vulncat.fortify.com/en/detail?id=desc.internal.cpp.buffer_overflow_off_by_one

Code Snippet:

line[0] = '\n';
while (fgets(line+1, buffer_size, fp_find))
{
if (strstr(list_target, line) == NULL)

This code is susceptible to buffer overflow as reflected in above wiki. Can you please provide solution for same? Recommendations: https://stackoverflow.com/questions/574159/what-is-a-buffer-overflow-and-how-do-i-cause-one