Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
netcontrol.14434
0003-sysconfig-fix-segfault-on-missed-end-quote...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0003-sysconfig-fix-segfault-on-missed-end-quote-bsc-10277.patch of Package netcontrol.14434
From ca57462e67fdbd30269117d0e75a2257efefdefd Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski <mt@suse.de> Date: Fri, 28 Feb 2020 16:10:53 +0100 References: bsc#1027736 Upstream: merged Subject: [PATCH] sysconfig: fix segfault on missed end-quote (bsc#1027736) diff --git a/src/sysconfig.c b/src/sysconfig.c index 48e929b..d03f23a 100644 --- a/src/sysconfig.c +++ b/src/sysconfig.c @@ -91,31 +91,32 @@ nc_sysconfig_free(nc_sysconfig_t *nsc) static int __unquote(char *string) { - char *src, *dst, cc; + char *src, *dst, qc = 0, lc = 0; + unsigned char cc; + int ret = 1; src = dst = string; - while ((cc = *src++) != '\0') { - if (isspace(cc)) + if (*string == '"' || *string == '\'') { + qc = *string; + src++; + } + do { + cc = *src; + if (!cc) { + ret = qc && lc == qc; break; - if (*string == '"') { - while ((cc = *src++) != '"') { - if (cc == '\\') { - cc = *src++; - if (cc == '\0') - return 0; - } - *dst++ = cc; - } - } else if (*string == '\'') { - while ((cc = *src++) != '\'') - *dst++ = cc; - string = dst; - } else { - *dst++ = cc; } - } + if (isspace(cc) && !qc) + break; + if (cc == qc) + break; + *dst = lc = cc; + dst++; + src++; + } while (1); + *dst = '\0'; - return 1; + return ret; } static int -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor