]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: fix script Type= and Id= parsing
authorKarel Zak <kzak@redhat.com>
Tue, 25 Oct 2016 10:32:23 +0000 (12:32 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 25 Oct 2016 10:32:23 +0000 (12:32 +0200)
The parser is not consistent and *case insensitive* Type= and Id= tokens
are not expected on all places.

Addresses: https://github.com/karelzak/util-linux/issues/367
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/script.c

index 0d89fdaf15f6e8d68e0b79d4bd8dad695a1f1294..4c1f9c7b968a6970a94e1ec5ee8da0fa85242920 100644 (file)
@@ -904,11 +904,10 @@ static int parse_line_nameval(struct fdisk_script *dp, char *s)
                        rc = next_string(&p, &pa->name);
 
                } else if (!strncasecmp(p, "type=", 5) ||
-
                           !strncasecmp(p, "Id=", 3)) {         /* backward compatibility */
                        char *type;
 
-                       p += (*p == 'I' ? 3 : 5);               /* "Id=" or "type=" */
+                       p += ((*p == 'I' || *p == 'i') ? 3 : 5); /* "Id=", "type=" */
 
                        rc = next_string(&p, &type);
                        if (rc)