Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752207AbdHLRgb (ORCPT ); Sat, 12 Aug 2017 13:36:31 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:34417 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751975AbdHLRg1 (ORCPT ); Sat, 12 Aug 2017 13:36:27 -0400 X-ME-Sender: X-Sasl-enc: +zxkD0MaDcvp64EY8Y8azrtvPEEmkyKZaQ1g7SYpMhip 1502559072 From: Michael Sartain To: Steven Rostedt Cc: Michael Sartain , linux-kernel@vger.kernel.org Subject: [PATCH 2/5] trace-cmd: Fix NULL pointer being passed to memcpy Date: Sat, 12 Aug 2017 11:30:44 -0600 Message-Id: <20170812173047.840-3-mikesart@fastmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170812173047.840-1-mikesart@fastmail.com> References: <20170812173047.840-1-mikesart@fastmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 597 Lines: 24 Signed-off-by: Michael Sartain --- 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