DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Hunt, David" <david.hunt@intel.com>
To: Reshma Pattan <reshma.pattan@intel.com>, dev@dpdk.org
Cc: stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] examples/vm_power_manager: fix string overflow
Date: Mon, 15 Apr 2019 15:45:12 +0100	[thread overview]
Message-ID: <bd0104b3-53c1-56b5-e0f9-3f7566c45f26@intel.com> (raw)
Message-ID: <20190415144512.w6hxp8MV-8hJvtKYFS9PvzlrcToZvaVZMsIFx1dkN6E@z> (raw)
In-Reply-To: <20190410145431.35269-1-reshma.pattan@intel.com>

On 10/4/2019 3:54 PM, Reshma Pattan wrote:
> Use strlcpy instead of strcpy to fix string overflow.
>
> Coverity issue: 337671
> Fixes: a63504a90f ("examples/power: add JSON string handling")
> CC: david.hunt@intel.com
> CC: stable@dpdk.org
>
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>   examples/vm_power_manager/channel_monitor.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
> index 74df0fe20..0b44a74b5 100644
> --- a/examples/vm_power_manager/channel_monitor.c
> +++ b/examples/vm_power_manager/channel_monitor.c
> @@ -159,7 +159,8 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt)
>   			if (ret)
>   				return ret;
>   		} else if (!strcmp(key, "name")) {
> -			strcpy(pkt->vm_name, json_string_value(value));
> +			strlcpy(pkt->vm_name, json_string_value(value),
> +					sizeof(pkt->vm_name));
>   		} else if (!strcmp(key, "command")) {
>   			char command[32];
>   			strlcpy(command, json_string_value(value), 32);


Acked-by: David Hunt <david.hunt@intel.com>


  parent reply	other threads:[~2019-04-15 14:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 14:54 Reshma Pattan
2019-04-10 14:54 ` Reshma Pattan
2019-04-15 14:45 ` Hunt, David [this message]
2019-04-15 14:45   ` Hunt, David
2019-04-22 21:09   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2019-04-22 21: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=bd0104b3-53c1-56b5-e0f9-3f7566c45f26@intel.com \
    --to=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=reshma.pattan@intel.com \
    --cc=stable@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).