]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
cmd: fru: Also write terminating char to arrays
authorMichal Simek <michal.simek@xilinx.com>
Tue, 16 Apr 2019 06:27:30 +0000 (08:27 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 6 Jun 2019 11:46:52 +0000 (13:46 +0200)
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 <michal.simek@xilinx.com>
common/fru_ops.c

index 778dce232515739c2f444beee6610714bc62b7a1..3c9d280453673474a7a3bc2ac4966522a4d4dca3 100644 (file)
@@ -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;
        }