]> git.ipfire.org Git - thirdparty/tar.git/commit
Fix xsparse.c big heap allocation bugs
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 6 Nov 2024 18:02:02 +0000 (10:02 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 6 Nov 2024 18:18:55 +0000 (10:18 -0800)
commitac06d4d104b540d7f09f6194b006905dab4622a2
tree5be1d3fe06ace07038edb6da49d74499d1d5a4a5
parenta855a80d064c18e1d610136e3574659c53388c13
Fix xsparse.c big heap allocation bugs

* scripts/xsparse.c (expand_sparse): Read into auto buffer, not heap.
The heap code was wrong for two reasons: it called malloc just once
in the try-again loop, and even when it succeeded it could have
left so few bytes available in the heap that later stdio calls
could fail.  Reading into the auto buffer might be a bit slower
but speed is not an issue here and it’s better to be simple.
scripts/xsparse.c