1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd
Martijn Dekker 69d37d5eae parse.c: fix use-after-free probs related to funstaks()
When the funstaks() function deletes a stack, other code could
still reference that stack's pointer, at least if a script's DEBUG
trap changed the function context by assigning to ${.sh.level}.
This crashed @ormaaj's funcname.ksh script in certain contexts, at
least when run as a dot script or in a virtual subshell.

This allows that script to run in all contexts by making
funstaks(s) set the stack pointer to NULL after deleting the stack
and making various other points in the code check for a null
pointer before dereferencing it.

This may not be the most elegant fix but (in my testing) it does
work, even when compiling ksh with AddressSanitiser.

Thanks to @JohnoKing for help researching this problem.

Resolves: https://github.com/ksh93/ksh/issues/212
2022-06-14 13:47:00 +01:00
..
builtin Another build system overhaul (re: 35672208, 580ff616, 6cc2f6a0) 2022-06-12 05:47:02 +01:00
INIT Another build system overhaul (re: 35672208, 580ff616, 6cc2f6a0) 2022-06-12 05:47:02 +01:00
ksh93 parse.c: fix use-after-free probs related to funstaks() 2022-06-14 13:47:00 +01:00
Mamfile Another build system overhaul (re: 35672208, 580ff616, 6cc2f6a0) 2022-06-12 05:47:02 +01:00