wininet: Fixed buffer size rising in get_cookie.

This commit is contained in:
Jacek Caban 2014-09-02 13:05:34 +02:00 committed by Alexandre Julliard
parent b03606c5e6
commit 55e3ec650e
1 changed files with 7 additions and 6 deletions

View File

@ -635,17 +635,18 @@ static DWORD get_cookie(const WCHAR *host, const WCHAR *path, DWORD flags, cooki
if((cookie_iter->flags & INTERNET_COOKIE_HTTPONLY) && !(flags & INTERNET_COOKIE_HTTPONLY)) if((cookie_iter->flags & INTERNET_COOKIE_HTTPONLY) && !(flags & INTERNET_COOKIE_HTTPONLY))
continue; continue;
if(res->size) {
if(!res->size) {
res->cookies = heap_alloc(4*sizeof(*res->cookies));
if(!res->cookies)
continue;
res->size = 4;
}else if(res->cnt == res->size) {
cookie_t **new_cookies = heap_realloc(res->cookies, res->size*2*sizeof(*res->cookies)); cookie_t **new_cookies = heap_realloc(res->cookies, res->size*2*sizeof(*res->cookies));
if(!new_cookies) if(!new_cookies)
continue; continue;
res->cookies = new_cookies; res->cookies = new_cookies;
res->size *= 2; res->size *= 2;
}else {
res->cookies = heap_alloc(4*sizeof(*res->cookies));
if(!res->cookies)
continue;
res->size = 4;
} }
if(res->cnt) if(res->cnt)