]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (script) make bootable flag parsing more robust
authorKarel Zak <kzak@redhat.com>
Wed, 26 Oct 2016 12:01:29 +0000 (14:01 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 26 Oct 2016 12:01:29 +0000 (14:01 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/script.c

index e90c18ab071e60951aa666afa2fba7755f992a34..ae7e99a1437c61aecb0f48abc50286449209ae14 100644 (file)
@@ -911,8 +911,9 @@ static int parse_line_nameval(struct fdisk_script *dp, char *s)
                        }
 
                } else if (!strncasecmp(p, "bootable", 8)) {
+                       /* we use next_token() to skip possible extra space */
                        char *tk = next_token(&p);
-                       if (strcmp(tk, "bootable") == 0)
+                       if (tk && strcasecmp(tk, "bootable") == 0)
                                pa->boot = 1;
                        else
                                rc = -EINVAL;