libfdisk: (script) fix segmentation fault

This patch fixes a segmentation fault that occurs if the name value is
empty (i.e. name=).

Signed-off-by: Gaël PORTAY <gael.portay@collabora.com>
This commit is contained in:
Gaël PORTAY 2020-03-20 16:10:35 -04:00
parent f205a07363
commit 3468dda9c3
1 changed files with 2 additions and 1 deletions

View File

@ -1059,7 +1059,8 @@ static int parse_line_nameval(struct fdisk_script *dp, char *s)
} else if (!strncasecmp(p, "name=", 5)) {
p += 5;
rc = next_string(&p, &pa->name);
unhexmangle_string(pa->name);
if (!rc)
unhexmangle_string(pa->name);
} else if (!strncasecmp(p, "type=", 5) ||
!strncasecmp(p, "Id=", 3)) { /* backward compatibility */