]> git.ipfire.org Git - thirdparty/tar.git/commit
maint: fix some unlikely wordsplit overflows
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 29 Jul 2024 22:36:47 +0000 (15:36 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Aug 2024 08:41:42 +0000 (01:41 -0700)
commitf22b9fe3ce4ca1580b6a1c3822ecdd26ae2b2c66
tree0f1cda4fe0aae7408d93fc26979a50e20da9c4dd
parent8f094605a8c7e04579bfe0eb521015d76b8f1d76
maint: fix some unlikely wordsplit overflows

* gnulib.modules: Add reallocarray.
* lib/wordsplit.c: Include stdckdint.h.
(ISDELIM, expvar, isglob, scan_word):
Defend against strchr (s, 0) always succeeding.
(alloc_space, wsplit_assign_vars):
Fix some unlikely integer overflows, partly by using reallocarray.
(alloc_space): Avoid quadratic worst-case behavior.
(isglob): Return bool, not int.  Accept size_t, not int.
(to_num): Remove; no longer used.
(xtonum): Clarify the code the bit.  Rely on portable
conversion to unsigned char rather than problematic pointer cast.
gnulib.modules
lib/wordsplit.c