Set argv[argc] to 0 in 'config_args' libc plugin

Fixes #201.
This commit is contained in:
Christian Prochaska 2012-05-10 14:51:12 +02:00 committed by Norman Feske
parent ac628b106b
commit b45571e9d0

View File

@ -47,7 +47,7 @@ void init_config_args(void)
if (argc == 0)
return;
argv = (char**)env()->heap()->alloc(argc * sizeof(char*));
argv = (char**)env()->heap()->alloc((argc + 1) * sizeof(char*));
/* read the arguments */
Xml_node arg_node = config()->xml_node().sub_node("arg");
@ -62,6 +62,8 @@ void init_config_args(void)
}
} catch (Xml_node::Nonexistent_sub_node) { }
argv[argc] = 0;
/* register command-line arguments at Genode's startup code */
genode_argc = argc;
genode_argv = argv;