Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
spawn: fix possible NULL dereferences
  • Loading branch information
perexg committed Nov 16, 2014
1 parent b6fcb45 commit 114298a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/spawn.c
Expand Up @@ -108,14 +108,17 @@ spawn_reap(char *stxt, size_t stxtlen)
if (stxt)
snprintf(stxt, stxtlen, "exited, status=%d", WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) {
snprintf(stxt, stxtlen, "killed by signal %d, "
"stopped by signal %d",
WTERMSIG(status),
WSTOPSIG(status));
if (stxt)
snprintf(stxt, stxtlen, "killed by signal %d, "
"stopped by signal %d",
WTERMSIG(status),
WSTOPSIG(status));
} else if (WIFCONTINUED(status)) {
snprintf(stxt, stxtlen, "continued");
if (stxt)
snprintf(stxt, stxtlen, "continued");
} else {
snprintf(stxt, stxtlen, "unknown status");
if (stxt)
snprintf(stxt, stxtlen, "unknown status");
}

if(s != NULL) {
Expand Down

0 comments on commit 114298a

Please sign in to comment.