patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Hunt, David" <david.hunt@intel.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>, dev@dpdk.org
Cc: stable@dpdk.org
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v1] examples/vm_power_manager: fix string null termination
Date: Fri, 26 Apr 2019 12:16:23 +0100	[thread overview]
Message-ID: <9cba436d-14e7-21c3-96fb-85c9ac6ba8ec@intel.com> (raw)
In-Reply-To: <46433916-0e77-fd36-94fc-0cb855fac3b9@intel.com>

Hi Anatoly,

On 26/4/2019 11:33 AM, Burakov, Anatoly wrote:
> On 26-Apr-19 9:43 AM, David Hunt wrote:
>> coverity complains about a null-termination after a read,
>> so we terminate conditionally on whether idx is within
>> the buffer or at the end of the buffer.
>>
>> Coverity issue: 337680
>> Fixes: a63504a90f ("examples/power: add JSON string handling")
>> CC: stable@dpdk.org
>> Signed-off-by: David Hunt <david.hunt@intel.com>
>> ---
>>   examples/vm_power_manager/channel_monitor.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/examples/vm_power_manager/channel_monitor.c 
>> b/examples/vm_power_manager/channel_monitor.c
>> index 971e4f2bc..711722fef 100644
>> --- a/examples/vm_power_manager/channel_monitor.c
>> +++ b/examples/vm_power_manager/channel_monitor.c
>> @@ -808,6 +808,7 @@ read_json_packet(struct channel_info *chan_info)
>>           int indent = 0;
>>           do {
>>               n_bytes = read(chan_info->fd, &json_data[idx], 1);
>> +            json_data[idx + (idx < MAX_JSON_STRING_LEN - 1)] = '\0';
>
> Why do it inside the loop and not after?
>

No reason, really. I'll move it outside and re-spin.


>>               if (n_bytes == 0)
>>                   break;
>>               if (json_data[idx] == '{')
>>
>
>

  reply	other threads:[~2019-04-26 11:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26  8:43 [dpdk-stable] " David Hunt
2019-04-26 10:33 ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
2019-04-26 11:16   ` Hunt, David [this message]
2019-04-26 11:24 ` [dpdk-stable] [PATCH v2] " David Hunt
2019-04-26 11:56   ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
2019-04-26 12:31     ` Bruce Richardson
2019-04-26 12:47       ` Burakov, Anatoly
2019-04-26 14:04   ` [dpdk-stable] [PATCH v3] " David Hunt
2019-04-26 14:10     ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
2019-05-02 23:43       ` 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=9cba436d-14e7-21c3-96fb-85c9ac6ba8ec@intel.com \
    --to=david.hunt@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --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).