mirror of
https://github.com/curl/curl.git
synced 2026-07-23 19:27:17 +03:00
rtmp: precaution for a potential integer truncation
On some platforms, socket descriptors may use types larger than int. When these values exceed INT_MAX, conversion to int can truncate to negative values causing RTMP connection failures, and even accidentally affect other socket when high-value descriptors map to existing lower-value sockets after integer conversion. This check ensures socket values are within the safe range before passing them to the RTMP library. Closes #19399
This commit is contained in:
parent
2d99cf0761
commit
a6fcaf2958
1 changed files with 5 additions and 0 deletions
|
|
@ -256,6 +256,11 @@ static CURLcode rtmp_connect(struct Curl_easy *data, bool *done)
|
|||
if(!r)
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
if(conn->sock[FIRSTSOCKET] > INT_MAX) {
|
||||
/* The socket value is invalid for rtmp. */
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
|
||||
r->m_sb.sb_socket = (int)conn->sock[FIRSTSOCKET];
|
||||
|
||||
/* We have to know if it is a write before we send the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue