libpkgconf: fragment: fix out of boundary write #196

Closed
stoeckmann wants to merge 1 commits from realloc into master
1 changed files with 2 additions and 0 deletions

View File

@ -442,8 +442,10 @@ fragment_quote(const pkgconf_fragment_t *frag)
if ((ptrdiff_t)(dst - out) + 2 > outlen) if ((ptrdiff_t)(dst - out) + 2 > outlen)
{ {
ptrdiff_t offset = dst - out;
outlen *= 2; outlen *= 2;
out = realloc(out, outlen); out = realloc(out, outlen);
dst = out + offset;
} }
} }