From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aTsjv-0005VR-L9 for barebox@lists.infradead.org; Thu, 11 Feb 2016 15:01:04 +0000 From: Sascha Hauer Date: Thu, 11 Feb 2016 16:00:39 +0100 Message-Id: <1455202840-26501-1-git-send-email-s.hauer@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 1/2] blspec: Do not crash on config files without newline on last line To: Barebox List When the last line in a config file has no newline then 'next' is NULL on the the loop iteration. Check that before derefencing 'next'. Signed-off-by: Sascha Hauer --- common/blspec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/blspec.c b/common/blspec.c index d5ddb4f..0f806ca 100644 --- a/common/blspec.c +++ b/common/blspec.c @@ -75,7 +75,7 @@ static struct blspec_entry *blspec_entry_open(struct blspec *blspec, next = buf; - while (*next) { + while (next && *next) { char *name, *val; line = next; -- 2.7.0.rc3 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox