From 869f2a84d68b34a00c34e3434dffd76cd48a4a06 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sat, 28 Nov 2020 16:01:16 +0100 Subject: [PATCH] pkgconf_pkg_parser_version_func: fix whitespace detection In case the version string has no whitespace then strcspn() returns strlen() of the input, so whitespace is only found if len != strlen. This fixes invalid warnings when parsing version fields. --- libpkgconf/pkg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index d420938..02c990d 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -100,7 +100,7 @@ pkgconf_pkg_parser_version_func(const pkgconf_client_t *client, pkgconf_pkg_t *p p = pkgconf_tuple_parse(client, &pkg->vars, value); len = strcspn(p, " \t"); - if (len) + if (len != strlen(p)) { i = p + (ptrdiff_t) len; *i = '\0';