[Toybox] [PATCH] ps: Allocate stdout buffer on heap.

Peter Collingbourne pcc at google.com
Fri Jul 26 20:13:49 PDT 2024


The top command exits via a call to xexit() from toy_exec_which(). At
this point we call exit handlers including top_cursor_cleanup(),
which will write to stdout, resulting in an attempt to use the stdout
buffer which was allocated in top_common()'s stack frame, which no
longer exists. Fix it by having top_common() allocate the stdout
buffer on the heap.
---
 toys/posix/ps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ps-Allocate-stdout-buffer-on-heap.patch
Type: text/x-patch
Size: 639 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240726/914bce5c/attachment.bin>


More information about the Toybox mailing list