summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-02-11 15:57:24 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-02-11 16:00:27 +0100
commit0aae1dc98cf1b0c858e630448a1ec59d69bcec9d (patch)
treedb91bf6b3ab198bab751e8c9bfa77248e4b90782 /common
parent0fe011b6ffb4b04ae484c8c9ac5fe326f10e41c0 (diff)
downloadbarebox-0aae1dc98cf1b0c858e630448a1ec59d69bcec9d.tar.gz
barebox-0aae1dc98cf1b0c858e630448a1ec59d69bcec9d.tar.xz
blspec: Do not crash on config files without newline on last line
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 <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/blspec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/blspec.c b/common/blspec.c
index d5ddb4fbbd..0f806cac7a 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;