aboutsummaryrefslogtreecommitdiffstats
path: root/core/elflink/load_env32.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/elflink/load_env32.c')
-rw-r--r--core/elflink/load_env32.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/elflink/load_env32.c b/core/elflink/load_env32.c
index 49c5989c..23d6baa1 100644
--- a/core/elflink/load_env32.c
+++ b/core/elflink/load_env32.c
@@ -170,9 +170,10 @@ int create_args_and_load(char *cmdline)
* Generate a copy of argv on the stack as this is
* traditionally where process arguments go.
*
- * argv[0] must be the command name.
+ * argv[0] must be the command name. Remember to allocate
+ * space for the sentinel NULL.
*/
- argv = alloca(argc * sizeof(char *));
+ argv = alloca((argc + 1) * sizeof(char *));
for (i = 0, p = cmdline; i < argc; i++) {
char *start;