Whamcloud - gitweb
e2fsck: do not crash on long log file names
authorNickolai Zeldovich <nickolai@csail.mit.edu>
Tue, 8 Jan 2013 20:31:18 +0000 (15:31 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 9 Jan 2013 01:36:48 +0000 (20:36 -0500)
commit6dd83548f4193f8bfd7983240471db0d0c7af626
tree9613991d3d9004358cd592ff80b5d2c1d53bc23f
parentbf50beb9f6b4c4d4c9f8fc7fc81d716a9ee79218
e2fsck: do not crash on long log file names

Previously e2fsck would corrupt memory if the log file name was longer
than 100 bytes (e.g., a long log_filename value in e2fsck.conf or a
pattern that expands out to more than 100 bytes).  This was due to
incorrectly calling realloc() in append_string() on the struct string
instead of the malloc'ed char* buffer, among other problems.  This
patch fixes the call to realloc() and also ensures that the buffer is
grown by sufficiently many bytes (not just by 2x).

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/logfile.c