DPDK patches and discussions
 help / color / mirror / Atom feed
From: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
To: thomas.monjalon@6wind.com
Cc: dev@dpdk.org, Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Subject: [dpdk-dev] [PATCH v2] examples/vm_power_manager: buffer not null terminated
Date: Tue, 10 May 2016 17:49:22 +0200	[thread overview]
Message-ID: <1462895362-29323-1-git-send-email-danielx.t.mrzyglod@intel.com> (raw)
In-Reply-To: <1460473986-3816-1-git-send-email-danielx.t.mrzyglod@intel.com>

CID30691:
If the buffer is treated as a null terminated string in later operations,
a buffer overflow or over-read may occur.

In add_vm: The string buffer may not have a null terminator if the source
string's length is equal to the buffer size

Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 examples/vm_power_manager/channel_manager.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index 22c2ddd..e068ae2 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -667,6 +667,7 @@ add_vm(const char *vm_name)
 		return -1;
 	}
 	strncpy(new_domain->name, vm_name, sizeof(new_domain->name));
+	new_domain->name[sizeof(new_domain->name) - 1] = '\0';
 	new_domain->channel_mask = 0;
 	new_domain->num_channels = 0;
 
-- 
2.5.5

  parent reply	other threads:[~2016-05-10 14:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 15:13 [dpdk-dev] [PATCH] " Daniel Mrzyglod
2016-04-27 14:36 ` Thomas Monjalon
2016-05-10 15:49 ` Daniel Mrzyglod [this message]
2016-05-16 12:48   ` [dpdk-dev] [PATCH v2] " 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=1462895362-29323-1-git-send-email-danielx.t.mrzyglod@intel.com \
    --to=danielx.t.mrzyglod@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.com \
    /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).