From f7d0a86bf687b4ee11870937666806b289ee9a48 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 8 Sep 2014 12:20:50 +0200 Subject: [PATCH] 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. --- src/netbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netbase.cpp b/src/netbase.cpp index d5821d4465..954c11f77d 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -259,7 +259,7 @@ bool static Socks5(string strDest, int port, SOCKET& hSocket) strSocks5 += strDest; strSocks5 += static_cast((port >> 8) & 0xFF); strSocks5 += static_cast((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()) { CloseSocket(hSocket);