From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Mon, 10 Nov 2014 16:27:03 -0500 Subject: [U-Boot] [U-Boot,4/6] hush: fix segfault on syntax error In-Reply-To: <1414621302-32062-4-git-send-email-rabin@rab.in> References: <1414621302-32062-4-git-send-email-rabin@rab.in> Message-ID: <20141110212703.GU24724@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Oct 29, 2014 at 11:21:40PM +0100, Rabin Vincent wrote: > 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 Tested-by: Simon Glass