diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2016-07-29 15:26:18 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-08-08 23:08:31 +0000 |
commit | 804077dd3c34906147df98cf1ce865133ef5d609 (patch) | |
tree | c644d28ba2ab9c6d7ecaccb51902d1f57870bb4b | |
parent | de6a37983420f5067327b46bbfbefa3601c449aa (diff) | |
download | ipmi-fru-parser-804077dd3c34906147df98cf1ce865133ef5d609.tar.gz ipmi-fru-parser-804077dd3c34906147df98cf1ce865133ef5d609.zip |
Improper use of non-const c-string.
sd_bus_message_read(..."s"...) gives a pointer to a char*
from within the message. Even though the message is in
writable memory, it is generally bad to write to the char* from
within it. Also, as a reviewer it is less of a concern to see a
const char* that is lacking a free than it is a char*. Changing to
const char* hopefully avoids the confusion as to why the c-string
does not have a corresponding free.
Eventually this code will likely transition over to the sdbusplus
interfaces and this will be irrelevant.
Change-Id: I0dfe948bb2f0eee03042ba9b9dc7563995f59027
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
-rw-r--r-- | writefrudata.C | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/writefrudata.C b/writefrudata.C index ee94d79..bccaf0a 100644 --- a/writefrudata.C +++ b/writefrudata.C @@ -171,7 +171,8 @@ int ipmi_fru::setup_sd_bus_paths(void) int rc = 0; // What we need is BOARD_1, PRODUCT_1, CHASSIS_1 etc.. - char *inv_bus_name = NULL, *inv_obj_path, *inv_intf_name; + const char *inv_bus_name = NULL, *inv_obj_path = NULL, + *inv_intf_name = NULL; char fru_area_name[16] = {0}; char *sys_bus_name = NULL; sprintf(fru_area_name,"%s%d",iv_name.c_str(), iv_fruid); @@ -595,7 +596,7 @@ int get_defined_fru_area(sd_bus *bus_type, const uint8_t fruid, sd_bus_error bus_error = SD_BUS_ERROR_NULL; sd_bus_message *response = NULL; int rc = 0; - char *areas = NULL; + const char *areas = NULL; char *sys_bus_name = NULL; #ifdef __IPMI_DEBUG__ |