diff options
author | Federico Vaga <federico.vaga@vaga.pv.it> | 2017-04-23 12:22:58 +0200 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2017-04-26 10:49:42 -0400 |
commit | b9a0df2f1f4923916299459e8d56942dc8c45e70 (patch) | |
tree | 2f6ef2690d222ea8854814904ded48f58ee02572 | |
parent | c8bc47393693d6d6641bfcf9343b1a9adf83be2b (diff) | |
download | trace-cmd-b9a0df2f1f4923916299459e8d56942dc8c45e70.tar.gz |
trace-cmd: BUG fix malloc() pointer validation
To reproduce the bug
mkdir /sys/kernel/debug/tracing/instances/test
./trace-cmd show -B test -s -f
Failed to allocate instance path snapshot
Link: http://lkml.kernel.org/r/20170423102258.21609-6-federico.vaga@vaga.pv.it
Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r-- | trace-cmd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/trace-cmd.c b/trace-cmd.c index f7ea5f20..6a023e87 100644 --- a/trace-cmd.c +++ b/trace-cmd.c @@ -619,7 +619,7 @@ int main (int argc, char **argv) if (buffer) { path = malloc(strlen(buffer) + strlen("instances//") + strlen(file) + 1); - if (path) + if (!path) die("Failed to allocate instance path %s", file); sprintf(path, "instances/%s/%s", buffer, file); file = path; |