diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2017-07-27 16:07:50 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2017-07-27 16:07:50 -0300 |
commit | 09e241fb1271021e3615512debd3136891547562 (patch) | |
tree | 8245b6084607a34185cfa7d3d45f5228937020f1 /TraceScreen.c | |
parent | 3975e9ce5cba0e3972b2ddab28c198e000441501 (diff) |
Security review: check results of snprintf.
Calls marked with xSnprintf shouldn't fail.
Abort program cleanly if any of them does.
Diffstat (limited to 'TraceScreen.c')
-rw-r--r-- | TraceScreen.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/TraceScreen.c b/TraceScreen.c index 5a49d5fd..abef7120 100644 --- a/TraceScreen.c +++ b/TraceScreen.c @@ -91,8 +91,8 @@ void TraceScreen_draw(InfoScreen* this) { bool TraceScreen_forkTracer(TraceScreen* this) { char buffer[1001]; - int err = pipe(this->fdpair); - if (err == -1) return false; + int error = pipe(this->fdpair); + if (error == -1) return false; this->child = fork(); if (this->child == -1) return false; if (this->child == 0) { @@ -100,7 +100,7 @@ bool TraceScreen_forkTracer(TraceScreen* this) { dup2(this->fdpair[1], STDERR_FILENO); int ok = fcntl(this->fdpair[1], F_SETFL, O_NONBLOCK); if (ok != -1) { - snprintf(buffer, sizeof(buffer), "%d", this->super.process->pid); + xSnprintf(buffer, sizeof(buffer), "%d", this->super.process->pid); execlp("strace", "strace", "-p", buffer, NULL); } const char* message = "Could not execute 'strace'. Please make sure it is available in your $PATH."; |