libpkgconf: tuple: fix truncation when no overflow occurs

master
Ariadne Conill 2020-05-30 19:19:48 -06:00
parent 5eb9cae009
commit 354c87279b
1 changed files with 7 additions and 0 deletions

View File

@ -274,6 +274,7 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
for (pptr = ptr + 2; *pptr != '\0'; pptr++) for (pptr = ptr + 2; *pptr != '\0'; pptr++)
{ {
if (*pptr != '}') if (*pptr != '}')
{
if (vptr < vend) if (vptr < vend)
*vptr++ = *pptr; *vptr++ = *pptr;
else else
@ -282,6 +283,12 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
break; break;
} }
} }
else
{
*vptr = '\0';
break;
}
}
ptr += (pptr - ptr); ptr += (pptr - ptr);
kv = pkgconf_tuple_find_global(client, varname); kv = pkgconf_tuple_find_global(client, varname);