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.
master
Christoph Reiter 2020-11-28 16:01:16 +01:00 committed by Ariadne Conill
parent b218cae5a9
commit 869f2a84d6
1 changed files with 1 additions and 1 deletions

View File

@ -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); p = pkgconf_tuple_parse(client, &pkg->vars, value);
len = strcspn(p, " \t"); len = strcspn(p, " \t");
if (len) if (len != strlen(p))
{ {
i = p + (ptrdiff_t) len; i = p + (ptrdiff_t) len;
*i = '\0'; *i = '\0';