[PATCH] Improve execl* functions

Federico Terraneo fede.tft@hotmail.it
Sun Jan 26 11:14:11 GMT 2025


Hi,
I propose the following patch to the execl* functions in newlib that 
does the following:
- it returns an error if more than the maximum number of arguments are 
passed instead of corrupting the stack
- it allows to tweak the maximum number of arguments at the time of 
compiling newlib by defining the ARG_NUM_MAX macro

This patch is originally meant for the Miosix OS to allow reducing the 
maximum number of arguments with the intent of reducing the stack usage 
of the execl* functions in low memory microcontrollers, but I think it 
is of general applicability and can of course be useful also to increase 
this value for desktop-class targets.

Best regards,
Federico Terraneo


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-stack-overflow-in-exec-add-ARG_NUM_MAX.patch
Type: text/x-patch
Size: 3397 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/newlib/attachments/20250126/7c20308a/attachment.bin>


More information about the Newlib mailing list