]> git.ipfire.org Git - thirdparty/snapper.git/commit
Handle fpathconf() errors. 177/head
authorJustin Maggard <jmaggard@netgear.com>
Wed, 15 Jul 2015 19:26:47 +0000 (12:26 -0700)
committerJustin Maggard <jmaggard@netgear.com>
Wed, 15 Jul 2015 19:42:10 +0000 (12:42 -0700)
commitfe7fcaa0c2c9229cd5c1e24766a2a5ee67ef5a24
tree0dfdc20fa1a4eee842c5298766f935f33f5205c2
parent3194ded9d8398d7b3341a7e65f1541b3ebba200f
Handle fpathconf() errors.

In one place snapper calls fpathconf(.., _PC_NAME_MAX) to determine the size of
a buffer used to hold readdir_r() results.  fpathconf() may return -1 on error,
but this fpathconf() call's return value is unchecked.  This can result in
allocating a buffer that is too small for readdir_r()'s results, resulting in
out-of-bounds memory access.

Fix it by falling back to using NAME_MAX if fpathconf(.., _PC_NAME_MAX) fails.

Signed-off-by: Justin Maggard <jmaggard@netgear.com>
snapper/FileUtils.cc