lkml.org 
[lkml]   [2017]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/5] trace-cmd: Fix NULL pointer being passed to memcpy
Date
Signed-off-by: Michael Sartain <mikesart@fastmail.com>
---
trace-output.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/trace-output.c b/trace-output.c
index bfe6331..84b21b0 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 NULL data */
+ if (data)
+ memcpy(option->data, data, size);
+
list_add_tail(&option->list, &handle->options);

return option;
--
2.13.2
\
 
 \ /
  Last update: 2017-08-12 19:36    [W:0.067 / U:0.740 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site