aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2016-10-26 14:01:29 +0200
committerKarel Zak <kzak@redhat.com>2016-10-26 14:01:29 +0200
commit469acdb4496de69d69344def0adaba3176da7c1e (patch)
tree212668f98a0e5df7f77cf63e34a8df736636f0f3
parent16b5238eb354b2d8faa90cb5c9622963a5d6a1eb (diff)
downloadutil-linux-469acdb4496de69d69344def0adaba3176da7c1e.tar.gz
libfdisk: (script) make bootable flag parsing more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--libfdisk/src/script.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c
index e90c18ab07..ae7e99a143 100644
--- a/libfdisk/src/script.c
+++ b/libfdisk/src/script.c
@@ -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;