mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
socks_sspi: bail out on too long fields
A probably unnecessary precaution but since the field sizes are 16 bit in the protocol this makes sure to fail if they would ever be larger as that would go wrong. Reported in Joshua's sarif data Closes #18719
This commit is contained in:
parent
6796147910
commit
943166fed3
1 changed files with 12 additions and 3 deletions
|
|
@ -193,6 +193,11 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
if(sspi_send_token.cbBuffer) {
|
||||
socksreq[0] = 1; /* GSS-API subnegotiation version */
|
||||
socksreq[1] = 1; /* authentication message type */
|
||||
if(sspi_send_token.cbBuffer > 0xffff) {
|
||||
/* needs to fit in an unsigned 16 bit field */
|
||||
result = CURLE_COULDNT_CONNECT;
|
||||
goto error;
|
||||
}
|
||||
us_length = htons((unsigned short)sspi_send_token.cbBuffer);
|
||||
memcpy(socksreq + 2, &us_length, sizeof(short));
|
||||
|
||||
|
|
@ -399,9 +404,13 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
goto error;
|
||||
}
|
||||
|
||||
etbuf_size = sspi_w_token[0].cbBuffer +
|
||||
sspi_w_token[1].cbBuffer +
|
||||
sspi_w_token[2].cbBuffer;
|
||||
etbuf_size = sspi_w_token[0].cbBuffer + sspi_w_token[1].cbBuffer +
|
||||
sspi_w_token[2].cbBuffer;
|
||||
if(etbuf_size > 0xffff) {
|
||||
/* needs to fit in an unsigned 16 bit field */
|
||||
result = CURLE_COULDNT_CONNECT;
|
||||
goto error;
|
||||
}
|
||||
etbuf = malloc(etbuf_size);
|
||||
if(!etbuf) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue