Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1710336 > unrolled thread

[PATCH 2/5] trace-cmd: Fix NULL pointer being passed to memcpy

Started byMichael Sartain <mikesart@fastmail.com>
First post2017-08-12 19:40 +0200
Last post2017-08-12 19:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/5] trace-cmd: Fix NULL pointer being passed to memcpy Michael Sartain <mikesart@fastmail.com> - 2017-08-12 19:40 +0200

#1710336 — [PATCH 2/5] trace-cmd: Fix NULL pointer being passed to memcpy

FromMichael Sartain <mikesart@fastmail.com>
Date2017-08-12 19:40 +0200
Subject[PATCH 2/5] trace-cmd: Fix NULL pointer being passed to memcpy
Message-ID<udIye-3S9-27@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web