[PATCH 1/2] blspec: Do not crash on config files without newline on last line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux