From ea777adaf15afe3c7097a00d20865175536dd712 Mon Sep 17 00:00:00 2001 From: svost Date: Sat, 27 Feb 2016 20:13:01 +0300 Subject: [PATCH] Since the buffer is constant, we set the length directly --- src/netbase.cpp | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) 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 +} -- 1.7.1