Created attachment 121322 [details] [patch] fix heap overflow In the function fgetwln there's a 4 byte heap overflow. There is a while loop that has this check to see whether there's still enough space in the buffer: if (!fb->len || wused > fb->len) { If this is true more memory gets allocated. However this test won't be true if wused == fb->len, but at that point wused already points out of the buffer. Some lines later there's a write to the buffer: fb->wbuf[wused++] = wc; The fix is simple: Check for wused >= fb->len instead. See attached patch. This bug was found with the help of address sanitizer.
Thanks! This has been merged and released as part of 0.8.2.
This has been assigned CVE-2016-2090: http://openwall.com/lists/oss-security/2016/01/28/5
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.