mkrasimage: fix segmentation fault
authorMichael T Farnworth <michael@turf.org>
Sat, 22 Feb 2020 14:20:49 +0000 (14:20 +0000)
committerPetr Štetiar <ynezz@true.cz>
Sun, 1 Mar 2020 20:36:00 +0000 (21:36 +0100)
commitb468353a373d181c4362ff690d7b22a08f5f6949
treea14f73f26944fed298a30d6c02486ee4b4babd4c
parentc60be196933807cc0db90a36704e4505edd83eeb
mkrasimage: fix segmentation fault

Code was attempting to determine the size of the file
before it was actually known and allocating insufficient
memory space.  Images above a certain size caused a
segmentation fault.  Moving the calloc() ensured ensured
that large images didn't result in a buffer overflow on
memcpy().

Signed-off-by: Michael T Farnworth <michael@turf.org>
[fixed name in From to match one in SoB]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
tools/firmware-utils/src/mkrasimage.c