[Bug 2653] busybox grep with option -B can cause segmentation fault

bugzilla at busybox.net bugzilla at busybox.net
Sat Oct 2 10:41:49 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=2653

--- Comment #1 from Denys Vlasenko <vda.linux at googlemail.com>  ---
Proposed fix:

        } else if (lines_before > 0) {
+               if (lines_before > INT_MAX / sizeof(long long))
+                       lines_before = INT_MAX / sizeof(long long);
+               /* overflow in (lines_before * sizeof(x)) is prevented (above)
*/
                before_buf = xzalloc(lines_before * sizeof(before_buf[0]));
                IF_EXTRA_COMPAT(before_buf_size = xzalloc(lines_before *
sizeof(before_buf_size[0]));)
        }

I am committing it to git.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list