From: Gaël PORTAY Date: Fri, 20 Mar 2020 20:10:35 +0000 (-0400) Subject: libfdisk: (script) fix segmentation fault X-Git-Tag: v2.36-rc1~177^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3468dda9c34b1860d4b64f590651aab718b0cc5e;p=thirdparty%2Futil-linux.git 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 --- diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c index e73c8dcdb1..cc53c3b7db 100644 --- a/libfdisk/src/script.c +++ b/libfdisk/src/script.c @@ -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 */