fix possible copy of null buffer and validation of unitialized header
authorPetr Štetiar <ynezz@true.cz>
Tue, 22 Oct 2019 12:05:39 +0000 (14:05 +0200)
committerPetr Štetiar <ynezz@true.cz>
Sat, 9 Nov 2019 13:28:09 +0000 (14:28 +0100)
commitdbc1b1b71b240ed61ea32eda610fde839d87c5f0
tree0ef835a2b8951caabbe335e7233966fbe18be837
parent76d53deef8bb512255266d7a51918d300d8a6ab0
fix possible copy of null buffer and validation of unitialized header

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

 fwtool.c:257:2: warning: Null pointer passed as an argument to a 'nonnull' parameter
        memcpy(dest, dbuf->cur + dbuf->cur_len - cur_len, cur_len);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 fwtool.c:275:20: warning: The left operand of '!=' is a garbage value
         if (hdr->version != 0)
             ~~~~~~~~~~~~ ^

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