libpkgconf: tuple: fix out of boundary write #197

Closed
stoeckmann wants to merge 1 commits from tuple into master
1 changed files with 3 additions and 1 deletions

View File

@ -264,6 +264,7 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
else if (*(ptr + 1) == '{')
{
char varname[PKGCONF_ITEM_SIZE];
char *vend = varname + PKGCONF_ITEM_SIZE - 1;
char *vptr = varname;
const char *pptr;
char *kv, *parsekv;
@ -273,7 +274,8 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
for (pptr = ptr + 2; *pptr != '\0'; pptr++)
{
if (*pptr != '}')
*vptr++ = *pptr;
if (vptr < vend)
*vptr++ = *pptr;
else
{
*vptr = '\0';