From c718031b55296dd7b0b15075a1010d590df37d6b Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 16 Apr 2019 08:27:30 +0200 Subject: [PATCH] cmd: fru: Also write terminating char to arrays There is a need to also end up strings with terminating char \0 to be able to reread different structures. Signed-off-by: Michal Simek --- common/fru_ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/fru_ops.c b/common/fru_ops.c index 778dce23251..3c9d2804536 100644 --- a/common/fru_ops.c +++ b/common/fru_ops.c @@ -63,7 +63,7 @@ static int fru_parse_board(unsigned long addr) { u8 i, type; int len; - u8 *data; + u8 *data, *term; memcpy(&fru_data.brd.ver, (void *)addr, 6); addr += 6; @@ -89,6 +89,8 @@ static int fru_parse_board(unsigned long addr) if (!len) continue; memcpy(data, (u8 *)addr, len); + term = data + (u8)len; + *term = 0; addr += len; } -- 2.47.3