From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dhcp.luminatewireless.com (unknown [12.222.9.130]) by dpdk.org (Postfix) with ESMTP id EA4542BCC for ; Fri, 26 Feb 2016 08:11:19 +0100 (CET) Received: from mzhao.corp.luminatewireless.com (mzhao.corp.luminatewireless.com [172.16.2.11]) by dhcp.luminatewireless.com (Postfix) with SMTP id 21B7750C05CA for ; Thu, 25 Feb 2016 23:11:19 -0800 (PST) Received: (nullmailer pid 18472 invoked by uid 10013); Fri, 26 Feb 2016 07:11:19 -0000 From: Ming Zhao To: dev@dpdk.org Date: Thu, 25 Feb 2016 23:11:11 -0800 Message-Id: <1456470671-18425-1-git-send-email-mzhao@luminatewireless.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] Fix buffer overflow issue in app/test/commands.c(we add 1 extra byte for trailing \0). X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2016 07:11:20 -0000 Fix memleak of cmdline in app/test/test.c --- app/test/commands.c | 2 +- app/test/test.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test/commands.c b/app/test/commands.c index 9cb9606..5dfa599 100644 --- a/app/test/commands.c +++ b/app/test/commands.c @@ -439,7 +439,7 @@ int commands_init(void) commands_len += strlen(t->command) + 1; } - commands = malloc(commands_len); + commands = malloc(commands_len + 1); /* one more byte for \0 */ if (!commands) return -1; diff --git a/app/test/test.c b/app/test/test.c index f35b304..108a347 100644 --- a/app/test/test.c +++ b/app/test/test.c @@ -150,6 +150,7 @@ main(int argc, char **argv) } cmdline_interact(cl); cmdline_stdin_exit(cl); + cmdline_free(cl); #endif return 0; -- 1.9.1