src/fgetwln.c


Log

Author Commit Date CI Message
Guillem Jover 48107fc8 2021-11-28T23:19:16 build: Clarify link-time warnings Mention the involved function instead of stating an implicit "this function". Mention libbsd when proposing using an alternative libmd to make the context clear.
Guillem Jover 4feda870 2021-02-11T04:40:48 Require a semicolon for libbsd_link_warning() macro Remove the semicolon in the macro definition to force adding one on the call sites, to make the code look like an actual function.
Guillem Jover 3cabf46b 2018-05-21T03:15:59 Deprecate fgetwln() This function has the same problems as fgetln() which is already marked as deprecated.
Hanno Boeck c8f0723d 2016-01-27T15:10:11 Fix heap buffer overflow in fgetwln() 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; This bug was found with the help of address sanitizer. Warned-by: ASAN Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93881 Signed-off-by: Guillem Jover <guillem@hadrons.org>
Guillem Jover 32388fe5 2014-11-03T23:21:52 Use reallocarray() instead of malloc() or realloc()
Guillem Jover a97ce513 2012-11-23T21:19:45 Add new fgetwln() function Man page taken from FreeBSD.