summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2018-11-21 16:04:13 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-11-21 16:04:13 -0500
commitec73c95892cbbabe9da556e1f68db70a7ff3d46a (patch)
tree392d387bf13595ad150eaf64609f7a9ffddd08a9
parent6cc890440830c135a0519bff739c68357f401852 (diff)
downloadipmi-fru-parser-ec73c95892cbbabe9da556e1f68db70a7ff3d46a.tar.gz
ipmi-fru-parser-ec73c95892cbbabe9da556e1f68db70a7ff3d46a.zip
frup: gcc8: swap abusive use strncpy w/ memcpy
Fix the following warning under gcc8: | ../git/frup.cpp: In function 'void _append_to_dict(uint8_t, uint8_t*, IPMIFruInfo&)': | ../git/frup.cpp:664:24: error: 'char* strncpy(char*, const char*, size_t)' output truncated before terminating nul copying 2 bytes from a string of the same length [-Werror=stringop-truncation] | strncpy(bin_in_ascii, "0x", 2); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ Change-Id: Ia35d0ae733f0879f6c9d23126bab5fc899e89def Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
-rw-r--r--frup.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/frup.cpp b/frup.cpp
index 299c7cc..9ddb0f6 100644
--- a/frup.cpp
+++ b/frup.cpp
@@ -661,7 +661,7 @@ void _append_to_dict(uint8_t vpd_key_id, uint8_t* vpd_key_val,
/* We need the data represented as 0x...... */
if (vpd_val_len > 0)
{
- strncpy(bin_in_ascii, "0x", 2);
+ memcpy(bin_in_ascii, "0x", 2);
}
#if IPMI_FRU_PARSER_DEBUG
printf("_append_to_dict: VPD Key = [%s] : Type Code = [BINARY] :"
OpenPOWER on IntegriCloud