]> git.baikalelectronics.ru Git - uboot.git/commit
tools: mkenvimage: Fix possible segfault on stdin input
authorAlexander Dahl <ada@thorsis.com>
Fri, 20 Apr 2018 13:29:31 +0000 (15:29 +0200)
committerTom Rini <trini@konsulko.com>
Sat, 28 Apr 2018 22:32:24 +0000 (18:32 -0400)
commit9bff379ba074d64a8b0793c303d8a1fd6fd11084
tree44a4abd470789a87f9048694b5a23077e664c354
parentf4f86babf01d3b49dcf2fdf553e4b5617b0c98f7
tools: mkenvimage: Fix possible segfault on stdin input

The size of 'filebuf' was not increased as more and more bytes are read
from stdin, but 'filebuf' was always reallocated to the same fix size.
This works as long as only less bytes than the initial buffer size come
in, for more input this will segfault. (It actually does, I tested
that.) So for each loop cycle the buffer size has to be increased by the
number of bytes we want to read.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
tools/mkenvimage.c