fix segfault when line only contains newline

This commit is contained in:
josch
2014-09-17 21:33:19 +02:00
parent ebedf596db
commit 2d6a79062a
2 changed files with 9 additions and 1 deletions

4
main.c
View File

@@ -200,7 +200,9 @@ mfshell_run(mfshell_t *mfshell)
if (retval == -1) {
exit(1);
}
string_chomp(cmd);
if (cmd[strlen(cmd)-1] == '\n')
cmd[strlen(cmd)-1] = '\0';
printf("\n\r");