From: Ming Zhao <mzhao@luminatewireless.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] Fix buffer overflow issue in app/test/commands.c(we add 1 extra byte for trailing \0).
Date: Thu, 25 Feb 2016 23:11:11 -0800 [thread overview]
Message-ID: <1456470671-18425-1-git-send-email-mzhao@luminatewireless.com> (raw)
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
next reply other threads:[~2016-02-26 7:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 7:11 Ming Zhao [this message]
2016-03-05 22:09 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456470671-18425-1-git-send-email-mzhao@luminatewireless.com \
--to=mzhao@luminatewireless.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).