pkgconf/libpkgconf
Tobias Stoeckmann bd4ed1ca02 libpkgconf: fileio: prevent buffer overflow.
pkgconf_fgetline is called with a user-defined buffer, its size, and
a FILE stream to read input from.

If the buffer is almost completely filled and the file stream contains
an escaped character, then it is possible to trigger an off-by-one
buffer overflow with a '\0' character.

Easiest example to trigger this:

char buf[2];
pkgconf_fgetline(buf, sizeof(buf), stdin);

Enter "\\" (two backslashes) and press enter. If the library and the
program are compiled with address sanitizer, you will see the program
crashing. Otherwise it depends on your architecture what happens.

Since nobody should be using a buffer of only size 1 or 2, keep enough
space for a possibly escaped character in while loop by subtracting one
more byte for this situation, not just for '\0'.
2020-05-24 14:09:44 -06:00
..
argvsplit.c libpkgconf: argvsplit: fix escape handling in tokenizer (closes #163) 2017-12-14 22:41:14 -06:00
audit.c libpkgconf: document audit module 2016-12-10 19:28:34 -06:00
bsdstubs.c Minimal tweaks to compile with Visual C 2015 2017-06-04 19:19:55 -07:00
bsdstubs.h normalize include guards. closes #33 2019-05-25 16:00:09 -05:00
cache.c libpkgconf: cache: fix refcount issue exposed by recent depgraph solver changes 2017-12-08 13:39:40 -06:00
client.c fix the order of header includes 2019-06-08 04:55:52 +03:00
config.h.meson Fix build on windows with meson 2018-09-17 15:41:27 +02:00
dependency.c libpkgconf: dependency: preference uncoloured nodes in event of a dependency collision 2018-03-18 19:03:18 -05:00
fileio.c libpkgconf: fileio: prevent buffer overflow. 2020-05-24 14:09:44 -06:00
fragment.c libpkgconf: fragment: add pkgconf_fragment_copy_list() 2019-01-14 13:48:02 -06:00
iter.h normalize include guards. closes #33 2019-05-25 16:00:09 -05:00
libpkgconf-api.h normalize include guards. closes #33 2019-05-25 16:00:09 -05:00
libpkgconf.h personality: add support for WantDefaultStatic setting 2019-10-19 00:56:17 -05:00
meson.build Experiment to build with Meson (#119) 2017-06-19 19:03:00 -05:00
parser.c fix the order of header includes 2019-06-08 04:55:52 +03:00
path.c libpkgconf: path: fix memory leak when deduping paths (closes #39) 2019-07-11 03:43:18 -05:00
personality.c personality: add support for WantDefaultStatic setting 2019-10-19 00:56:17 -05:00
pkg.c libpkgconf: pkg: generate diagnostic for and trim malformed versions 2019-07-12 06:35:48 -05:00
queue.c libpkgconf: dependency: allow dependency nodes to be colored with traits 2018-03-18 18:03:33 -05:00
stdinc.h normalize include guards. closes #33 2019-05-25 16:00:09 -05:00
tuple.c libpkgconf: tuple: tighten quoting logic a bit 2019-03-23 22:34:11 -05:00
win-dirent.h normalize include guards. closes #33 2019-05-25 16:00:09 -05:00