mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] blspec: Do not crash on config files without newline on last line
@ 2016-02-11 15:00 Sascha Hauer
  2016-02-11 15:00 ` [PATCH 2/2] blspec: ignore lines beginning with '#' Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2016-02-11 15:00 UTC (permalink / raw)
  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 <s.hauer@pengutronix.de>
---
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] blspec: ignore lines beginning with '#'
  2016-02-11 15:00 [PATCH 1/2] blspec: Do not crash on config files without newline on last line Sascha Hauer
@ 2016-02-11 15:00 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2016-02-11 15:00 UTC (permalink / raw)
  To: Barebox List

According to the bootloader spec these should be treated as comments.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/blspec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/blspec.c b/common/blspec.c
index 0f806ca..1800556 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -86,6 +86,9 @@ static struct blspec_entry *blspec_entry_open(struct blspec *blspec,
 			next++;
 		}
 
+		if (*line == '#')
+			continue;
+
 		name = line;
 		end = name;
 
-- 
2.7.0.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-11 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-11 15:00 [PATCH 1/2] blspec: Do not crash on config files without newline on last line Sascha Hauer
2016-02-11 15:00 ` [PATCH 2/2] blspec: ignore lines beginning with '#' Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox