firmware-utils: mkfwimage: fix memcpy and strncpy usage
authorPetr Štetiar <ynezz@true.cz>
Fri, 26 Jul 2019 12:45:32 +0000 (14:45 +0200)
committerPetr Štetiar <ynezz@true.cz>
Sat, 11 Jul 2020 11:33:28 +0000 (13:33 +0200)
commit9308bf3c5e7ff867fb0c5abce23a9425db5439c6
tree6d5e161140964e1eafa30c9ace2ab89e12e3aa84
parent56326468c019a1119be9243020bc5bf9ea36ccaa
firmware-utils: mkfwimage: fix memcpy and strncpy usage

Firmware is binary blob, so there are barely any NULL terminated strings
expected, so we should probably convert all chars into u8 types, and
after that it's clear, that using strcpy doesn't make sense anymore.

This is rather theoretical stuff, but `uint8_t name[PART_NAME_LENGTH]`
means, that you can supply PART_NAME_LENGTH sized name, not
PART_NAME_LENGTH-1 name when NULL terminated.

Ref: https://github.com/openwrt/openwrt/pull/2274
Fixes: 04cb651376f9 ("firmware-utils: mkfwimage: fix more errors reported by gcc-6/7/9")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
src/fw.h
src/mkfwimage.c
src/utils.h [new file with mode: 0644]