From df2340e48d0a79d06e77bb8913c35c8dd39fdc52 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Sun, 2 May 2021 17:48:49 +0200 Subject: main: Fix NULL pointer derefernce --- src/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 55467ca..5a1cc35 100644 --- a/src/main.c +++ b/src/main.c @@ -182,8 +182,10 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) { *(parts++) = 0; layout_file = parts; - while ( ( ptr = strchr(layout_file, '%') ) ) - layout_file = ptr+1; + if ( layout_file ) { + while ( ( ptr = strchr(layout_file, '%') ) ) + layout_file = ptr+1; + } type = NULL; device = NULL; -- cgit v1.2.3