run_command: strlen() will not function if string is not null terminated
This commit is contained in:
parent
965a71d678
commit
8a29374783
@ -426,7 +426,7 @@ run_command(const char *cmd)
|
|||||||
}
|
}
|
||||||
fgets(buf, sizeof(buf), fp);
|
fgets(buf, sizeof(buf), fp);
|
||||||
pclose(fp);
|
pclose(fp);
|
||||||
buf[strlen(buf)] = '\0';
|
buf[sizeof(buf)] = '\0';
|
||||||
|
|
||||||
if ((nlptr = strstr(buf, "\n")) != NULL) {
|
if ((nlptr = strstr(buf, "\n")) != NULL) {
|
||||||
nlptr[0] = '\0';
|
nlptr[0] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user