From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Cc: dev@dpdk.org, alan.carew@intel.com
Subject: Re: [PATCH] examples/vm_power_manager: buffer not null terminated
Date: Wed, 27 Apr 2016 16:36:14 +0200 [thread overview]
Message-ID: <2816928.LRtXO1Vhg3@xps13> (raw)
In-Reply-To: <1460473986-3816-1-git-send-email-danielx.t.mrzyglod@intel.com>
2016-04-12 17:13, Daniel Mrzyglod:
> CID30691:
> If the buffer is treated as a null terminated string in later operations,
> a buffer overflow or over-read may occur.
[...]
> --- a/examples/vm_power_manager/channel_manager.c
> +++ b/examples/vm_power_manager/channel_manager.c
> - strncpy(new_domain->name, vm_name, sizeof(new_domain->name));
> + strncat(new_domain->name, vm_name, sizeof(new_domain->name) -
> + strlen(new_domain->name) - 1);
It looks to be a copy paste of a ready-to-use replacement of strncpy.
Why not just do new_domain->name[sizeof(new_domain->name) - 1] = 0 ?
next prev parent reply other threads:[~2016-04-27 14:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-12 15:13 [PATCH] examples/vm_power_manager: buffer not null terminated Daniel Mrzyglod
2016-04-27 14:36 ` Thomas Monjalon [this message]
2016-05-10 15:49 ` [PATCH v2] " Daniel Mrzyglod
2016-05-16 12:48 ` 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=2816928.LRtXO1Vhg3@xps13 \
--to=thomas.monjalon@6wind.com \
--cc=alan.carew@intel.com \
--cc=danielx.t.mrzyglod@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.