diff options
author | Reshma Pattan <reshma.pattan@intel.com> | 2019-04-09 17:00:24 +0100 |
---|---|---|
committer | Thomas Monjalon <thomas@monjalon.net> | 2019-04-23 00:15:10 +0200 |
commit | 4c2caea070fb1ceb16688870d44bd4016ce5d0e4 (patch) | |
tree | aa9c1e205c607e4ca382e28b3bf8e1afca245ddf | |
parent | 958d14d38659d96859718657743a963bd6e9f1f4 (diff) |
examples/power: fix string null termination
After the read() the jason_data null termination is missing
for the case "indent < 0", for "indent > 0" and "indent == 0"
cases null termination is already handled.
So add the missing case "indent < 0" to the existing "indent == 0"
case to fix null termination.
Coverity issue: 337680
Fixes: a63504a90f ("examples/power: add JSON string handling")
Cc: stable@dpdk.org
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
-rw-r--r-- | examples/vm_power_manager/channel_monitor.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index ad1ddde07f..bc5679d4b5 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -815,7 +815,7 @@ read_json_packet(struct channel_info *chan_info) indent--; if ((indent > 0) || (idx > 0)) idx++; - if (indent == 0) + if (indent <= 0) json_data[idx] = 0; if (idx >= MAX_JSON_STRING_LEN-1) break; |