[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20171016165542.13038-3-mikesart@fastmail.com>
Date: Mon, 16 Oct 2017 10:55:40 -0600
From: Michael Sartain <mikesart@...tmail.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Michael Sartain <mikesart@...tmail.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 2/4] trace-cmd: Fix NULL pointer being passed to memcpy
Signed-off-by: Michael Sartain <mikesart@...tmail.com>
---
trace-output.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/trace-output.c b/trace-output.c
index bfe6331..bbb1637 100644
--- a/trace-output.c
+++ b/trace-output.c
@@ -929,7 +929,11 @@ tracecmd_add_option(struct tracecmd_output *handle,
free(option);
return NULL;
}
- memcpy(option->data, data, size);
+
+ /* Some IDs (like TRACECMD_OPTION_TRACECLOCK) pass 0 / NULL data */
+ if (size)
+ memcpy(option->data, data, size);
+
list_add_tail(&option->list, &handle->options);
return option;
--
2.14.2
Powered by blists - more mailing lists