From: svost Date: Sat, 27 Feb 2016 17:13:01 +0000 (+0300) Subject: Since the buffer is constant, we set the length directly X-Git-Tag: nvc-v0.5.6~33^2^2~1 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=ea777adaf15afe3c7097a00d20865175536dd712 Since the buffer is constant, we set the length directly --- diff --git a/src/netbase.cpp b/src/netbase.cpp index 9bf5fe9..4699abf 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -221,11 +221,9 @@ bool static Socks5(string strDest, uint16_t port, SOCKET& hSocket) CloseSocket(hSocket); return error("Hostname too long"); } - char pszSocks5Init[] = "\5\1\0"; - ssize_t nSize = sizeof(pszSocks5Init) - 1; - - ssize_t ret = send(hSocket, pszSocks5Init, nSize, MSG_NOSIGNAL); - if (ret != nSize) + const char pszSocks5Init[] = "\5\1\0"; + ssize_t ret = send(hSocket, pszSocks5Init, 3, MSG_NOSIGNAL); + if (ret != 3) { CloseSocket(hSocket); return error("Error sending to proxy"); @@ -1193,4 +1191,4 @@ bool CloseSocket(SOCKET& hSocket) #endif hSocket = INVALID_SOCKET; return ret != SOCKET_ERROR; -} \ No newline at end of file +}