]> Savannah Git Hosting - gnulib.git/commit
modechange: avoid memory leaks for invalid octal modes
authorBernhard Voelker <mail@bernhard-voelker.de>
Wed, 26 Mar 2014 00:42:11 +0000 (01:42 +0100)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 26 Mar 2014 01:25:27 +0000 (18:25 -0700)
commit9b784e734cbabe0d25bcf0f845a75674af699342
tree7414d86c64bb16f479fdbd6656e6465c28c642b3
parent602f4c2fe30c5844bdb84f3e1b767baee7cd5b1b
modechange: avoid memory leaks for invalid octal modes

* lib/modechange.c (mode_compile): During the parsing of
notations like +40, free the 'mc' buffer for invalid mode
strings like +17777 (greater than the maximum octal mode),
=18 (bad octal mode characters) or u=1 ('affected' with
octal modes).
Reproducer, e.g.:

    $ valgrind --leak-check=full chmod +17777 file

Introduced via the 2012-03-09 commit, 4730c3e3, "modechange:
add notations +40, 00440, etc.".
Spotted by coverity (RESOURCE_LEAK).
ChangeLog
lib/modechange.c