diff --git a/NEWS b/NEWS index 97fc2ef..bf8cdd3 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ Changes from 1.6.0 to 1.6.1: paths. - Use POSIX realpath(3) instead of readlink() for deduplicating the search path. Use _fullpath() on Windows for the same purpose. + - The dequoting logic for tuples has been improved to ensure that + quotes *inside* a value remain quoted when necessary. Changes from 1.5.4 to 1.6.0: ---------------------------- diff --git a/libpkgconf/tuple.c b/libpkgconf/tuple.c index 8523709..f505abd 100644 --- a/libpkgconf/tuple.c +++ b/libpkgconf/tuple.c @@ -144,17 +144,18 @@ dequote(const char *value) const char *i; char quote = 0; + if (*value == '\'' || *value == '"') + quote = *value; + for (i = value; *i != '\0'; i++) { - if (!quote && (*i == '\'' || *i == '"')) - quote = *i; - else if (*i != quote) - *bptr++ = *i; - else if (*i == '\\' && *(i + 1) == quote) + if (*i == '\\' && quote && *(i + 1) == quote) { i++; *bptr++ = *i; } + else if (*i != quote) + *bptr++ = *i; } return buf;