fix possible garbage in unitialized char* struct members
authorPetr Štetiar <ynezz@true.cz>
Wed, 23 Oct 2019 10:11:47 +0000 (12:11 +0200)
committerPetr Štetiar <ynezz@true.cz>
Sat, 9 Nov 2019 13:28:09 +0000 (14:28 +0100)
commit9d9d4c2847862adec2f474d4126213c17f98e024
treef85933ce32d6c854ea23bbc3793ce63ef2f5e76d
parentdbc1b1b71b240ed61ea32eda610fde839d87c5f0
fix possible garbage in unitialized char* struct members

scan-build from clang version 9 has reported following issues:

 crc32.h:44:32: warning: The right operand of '^' is a garbage value
                val = crc_table[(uint8_t)val ^ *(uint8_t*)buf] ^ (val >> 8);
                                             ^ ~~~~~~~~~~~~~~

cppcheck version 1.89 has reported following issues:

 fwtool.c:260:9: error: Uninitialized variable: dest [uninitvar]
  memcpy(dest, dbuf->cur + dbuf->cur_len - cur_len, cur_len);
         ^
 fwtool.c:333:27: note: Calling function 'extract_tail', 2nd argument '&tr' value is <Uninit>
   if (extract_tail(&dbuf, &tr, sizeof(tr))) {
                           ^

Signed-off-by: Petr Štetiar <ynezz@true.cz>
fwtool.c