[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170423102258.21609-6-federico.vaga@vaga.pv.it>
Date: Sun, 23 Apr 2017 12:22:58 +0200
From: Federico Vaga <federico.vaga@...a.pv.it>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Federico Vaga <federico.vaga@...a.pv.it>
Subject: [PATCH 5/5] 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
Signed-off-by: Federico Vaga <federico.vaga@...a.pv.it>
---
trace-cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/trace-cmd.c b/trace-cmd.c
index a05df92..320229e 100644
--- a/trace-cmd.c
+++ b/trace-cmd.c
@@ -616,7 +616,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;
--
2.9.3
Powered by blists - more mailing lists