Fix CVE-2019-5481

Merge: curl/curl@9069838b30
This commit is contained in:
Kawe Mazidjatari 2023-06-12 21:36:38 +02:00
parent 0920fb834a
commit 0ac029e1c0

View File

@ -193,7 +193,6 @@ static CURLcode read_data(struct connectdata *conn,
struct krb5buffer *buf)
{
int len;
void *tmp = NULL;
CURLcode result;
result = socket_read(fd, &len, sizeof(len));
@ -203,12 +202,11 @@ static CURLcode read_data(struct connectdata *conn,
if(len) {
/* only realloc if there was a length */
len = ntohl(len);
tmp = Curl_saferealloc(buf->data, len);
buf->data = Curl_saferealloc(buf->data, len);
}
if(tmp == NULL)
if(!len || !buf->data)
return CURLE_OUT_OF_MEMORY;
buf->data = tmp;
result = socket_read(fd, buf->data, len);
if(result)
return result;