examples/power: fix json null termination
coverity complains about a null-termination after a read,
so we terminate once we exit the do-while read loop.
Coverity issue: 337680
Fixes: a63504a90f
("examples/power: add JSON string handling")
Cc: stable@dpdk.org
Signed-off-by: David Hunt <david.hunt@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
This commit is contained in:
parent
3f1fc5f2cb
commit
8f8f876bd7
@ -822,12 +822,7 @@ read_json_packet(struct channel_info *chan_info)
|
||||
break;
|
||||
} while (indent > 0);
|
||||
|
||||
if (indent > 0)
|
||||
/*
|
||||
* We've broken out of the read loop without getting
|
||||
* a closing brace, so throw away the data
|
||||
*/
|
||||
json_data[idx] = 0;
|
||||
json_data[idx] = '\0';
|
||||
|
||||
if (strlen(json_data) == 0)
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user