file: fix segfault in uci_parse_config
authorLuka Koznjak <luka.koznjak@sartura.hr>
Wed, 4 Dec 2019 20:35:10 +0000 (21:35 +0100)
committerLuka Perkov <luka.perkov@sartura.hr>
Mon, 27 Jan 2020 22:24:48 +0000 (23:24 +0100)
commitaa5e77a13d955ac9b497efc015c957c475734f0d
tree01c538db7bf4efca05e0af86caae28ba327249fe
parent165b444131453d63fc78c1d86f23c3ca36a2ffd7
file: fix segfault in uci_parse_config

Fixed a segmentation fault caused by using a pointer to a reallocated
address. The name pointer in the uci_parse_config function
becomes invalid if assert_eol calls uci_realloc down the line,
resulting in a segmentation fault when attempting to dereference
name. A simple fix is to call assert_eol before retrieving the
actual address for the name and type pointers.

The segmentation fault has been found while fuzzing the
uci configuration system for various types of different crashes
and undefined behavious, which resulted in multiple different
import files causing instability and sementation faults.

Signed-off-by: Luka Kožnjak <luka.koznjak@sartura.hr>
Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>
CC: Luka Perkov <luka.perkov@sartura.hr>
file.c