mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 02:11:24 +02:00
netbase: Use .data() instead of .c_str() on binary string
`.c_str()` is only guaranteed to return the data up to the first NUL character.
This commit is contained in:
@ -259,7 +259,7 @@ bool static Socks5(string strDest, int port, SOCKET& hSocket)
|
|||||||
strSocks5 += strDest;
|
strSocks5 += strDest;
|
||||||
strSocks5 += static_cast<char>((port >> 8) & 0xFF);
|
strSocks5 += static_cast<char>((port >> 8) & 0xFF);
|
||||||
strSocks5 += static_cast<char>((port >> 0) & 0xFF);
|
strSocks5 += static_cast<char>((port >> 0) & 0xFF);
|
||||||
ret = send(hSocket, strSocks5.c_str(), strSocks5.size(), MSG_NOSIGNAL);
|
ret = send(hSocket, strSocks5.data(), strSocks5.size(), MSG_NOSIGNAL);
|
||||||
if (ret != (ssize_t)strSocks5.size())
|
if (ret != (ssize_t)strSocks5.size())
|
||||||
{
|
{
|
||||||
CloseSocket(hSocket);
|
CloseSocket(hSocket);
|
||||||
|
Reference in New Issue
Block a user