summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2015-11-25 17:32:08 +1030
committerJoel Stanley <joel@jms.id.au>2015-11-25 17:32:08 +1030
commit38310cd8821f8d99bcb4f925c518f250f6c41e43 (patch)
tree5708c0e17c9c2134ec4a4331445ba0eac6ebdf97
parent0c88b3cfeabb7e9c1ae1d68467275760ba0419cf (diff)
downloadphosphor-host-ipmid-38310cd8821f8d99bcb4f925c518f250f6c41e43.tar.gz
phosphor-host-ipmid-38310cd8821f8d99bcb4f925c518f250f6c41e43.zip
apphandler: Remove out of bounds array access
apphandler.C:188:24: warning: array subscript is above array bounds [-Warray-bounds] tmp_array[3] = '\0'; ^ Initalise tmp_array to zero, and avoid this bad access. Signed-off-by: Joel Stanley <joel@jms.id.au>
-rw-r--r--apphandler.C3
1 files changed, 1 insertions, 2 deletions
diff --git a/apphandler.C b/apphandler.C
index d3df330..2c9ce6b 100644
--- a/apphandler.C
+++ b/apphandler.C
@@ -184,8 +184,7 @@ ipmi_ret_t ipmi_app_get_device_guid(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
for(i = 0; i < tmp_size; i++)
{
- char tmp_array[3]; // Holder of the 2 chars that will become a byte
- tmp_array[3] = '\0';
+ char tmp_array[3] = {0}; // Holder of the 2 chars that will become a byte
strncpy(tmp_array, id_octet, 2); // 2 chars at a time
int resp_byte = strtoul(tmp_array, NULL, 16); // Convert to hex byte
OpenPOWER on IntegriCloud