Skip to content
Snippets Groups Projects
Commit 128059b9 authored by Rabin Vincent's avatar Rabin Vincent Committed by Tom Rini
Browse files

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: default avatarRabin Vincent <rabin@rab.in>
Acked-by: default avatarSimon Glass <sjg@chromium.org)>
Tested-by: default avatarSimon Glass <sjg@chromium.org)>
parent 484408fb
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment