[PATCH] Fix use-after-free in glob when expanding ~user (bug 25414)
The value of `end_name' points into the value of `dirname', thus don't
deallocate the latter before the last use of the former.
posix/glob.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
I suggest using 'bool' instead of 'int' here, since the value is boolean
and glob_use_alloca returns 'bool'. Although some of the nearby local
vars use 'int' to represent booleans, surely this is because the code
predates 'bool'; for new code it's better to use 'bool' for booleans.