ramips: fix netgear r6120 factory image generation
authorKoen Vandeputte <[email protected]>
Thu, 8 Nov 2018 11:46:37 +0000 (12:46 +0100)
committerKoen Vandeputte <[email protected]>
Thu, 8 Nov 2018 12:32:22 +0000 (13:32 +0100)
commit3becff6ed255ba1a644c5a314602b25c13bdab13
tree663c00d80913a4fef0708772da9675644d6c2928
parenta6d5320fd890ee4db19d3058e45537dc59ebaf8e
ramips: fix netgear r6120 factory image generation

as indicated in commit c5bf408ed6bd "(ramips: fix image generation for mt76x8")
more rework was needed to fix the other issues.

Building on another machine, but using the same arch, showed
the application failing again for different reasons.

Fix this by completely rewriting the application, fixing following found issues:

- buffer overflows, resulting in stack corruption
- flaws in memory requirement calculations (too small, too large)
- memory leaks
- missing bounds checking on string handling
- non-reproducable images, by using unitilized memory in checksum calculation
- missing error handling, resulting in succes on specific image errors
- endianness errors when building on BE machines
- various minor build warnings
- documentation did not match the code actions (header item locations)
- allowing input to be decimal, hex or octal now

Signed-off-by: Koen Vandeputte <[email protected]>
src/mksercommfw.c