mirror of
https://github.com/curl/curl.git
synced 2026-08-25 14:33:44 +03:00
socks: avoid UAF risk in error path
The code obtained a pointer resp via Curl_bufq_peek(), but called Curl_bufq_skip() before it would access them in the failf() call. The Curl_bufq_skip() call can trigger prune_head which may free or recycle the chunk that resp points into. Pointed out by ZeroPath Closes #19139
This commit is contained in:
parent
f03e7c1d64
commit
8d302ec936
1 changed files with 1 additions and 2 deletions
|
|
@ -765,13 +765,12 @@ static CURLproxycode socks5_check_auth_resp(struct socks_state *sx,
|
||||||
|
|
||||||
/* ignore the first (VER) byte */
|
/* ignore the first (VER) byte */
|
||||||
auth_status = resp[1];
|
auth_status = resp[1];
|
||||||
Curl_bufq_skip(&sx->iobuf, 2);
|
|
||||||
|
|
||||||
if(auth_status) {
|
if(auth_status) {
|
||||||
failf(data, "User was rejected by the SOCKS5 server (%d %d).",
|
failf(data, "User was rejected by the SOCKS5 server (%d %d).",
|
||||||
resp[0], resp[1]);
|
resp[0], resp[1]);
|
||||||
return CURLPX_USER_REJECTED;
|
return CURLPX_USER_REJECTED;
|
||||||
}
|
}
|
||||||
|
Curl_bufq_skip(&sx->iobuf, 2);
|
||||||
return CURLPX_OK;
|
return CURLPX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue