From 08f7c4d55fdc334d250750386119ff0ede994ffc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ga=C3=ABl=20PORTAY?= Date: Fri, 20 Mar 2020 16:10:35 -0400 Subject: [PATCH] libfdisk: (script) fix segmentation fault MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch fixes a segmentation fault that occurs if the name value is empty (i.e. name=). Signed-off-by: Gaël PORTAY --- libfdisk/src/script.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c index 6f66f88b94..8a27c6d798 100644 --- a/libfdisk/src/script.c +++ b/libfdisk/src/script.c @@ -1057,7 +1057,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 */ -- 2.47.2