From: Rabin Vincent Date: Wed, 29 Oct 2014 22:21:40 +0000 (+0100) Subject: hush: fix segfault on syntax error X-Git-Tag: v2015.01-rc1~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=128059b926b3c34bbb364dcacd8d0511ff906be8;p=u-boot hush: fix segfault on syntax error Hush segfaults if it sees a syntax error while attempting to parse a command: $ ./u-boot -c "'" ... syntax error Segmentation fault (core dumped) This is due to a NULL pointer dereference of in_str->p in static_peek(). The problem is that the exit condition for the loop in parse_stream_outer() checks for rcode not being -1, but rcode is only ever 0 or 1. Signed-off-by: Rabin Vincent Acked-by: Simon Glass peek != static_peek || b_peek(inp))); #ifndef __U_BOOT__ return 0;