mirror of
https://github.com/troglobit/finit.git
synced 2026-11-20 19:41:51 +00:00
Fix SIGSEGV due to writes to const char array.
If no console is configured, then the following code gets executed:
int conf_parse_config(void)
{
...
char *fallback = FALLBACK_SHELL;
...
tty_register(fallback);
...
}
int tty_register(char *line)
{
...
cmd = strtok(line, " ");
...
}
FALLBACK_SHELL is constant character array and strtok tries to modify
the first argument, which causes a crash.
This commit is contained in:
1 parent
9a539c636a
commit
5b86c76694
1 file changed
+3
-1
@@ -519,10 +519,12 @@ int conf_parse_config(void)
|
|||||||
|
|
||||||
result = parse_conf(FINIT_CONF);
|
result = parse_conf(FINIT_CONF);
|
||||||
if (!tty_num()) {
|
if (!tty_num()) {
|
||||||
char *fallback = FALLBACK_SHELL;
|
char *fallback = NULL;
|
||||||
|
|
||||||
if (console)
|
if (console)
|
||||||
fallback = console;
|
fallback = console;
|
||||||
|
else
|
||||||
|
fallback = strdup(FALLBACK_SHELL);
|
||||||
|
|
||||||
tty_register(fallback);
|
tty_register(fallback);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user