git://git.novaco.in
/
novacoin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
d6d558a
)
netbase: Use .data() instead of .c_str() on binary string
author
Wladimir J. van der Laan
<laanwj@gmail.com>
Mon, 8 Sep 2014 10:20:50 +0000 (12:20 +0200)
committer
svost
<ya.nowa@yandex.ru>
Sun, 21 Feb 2016 14:47:25 +0000 (17:47 +0300)
`.c_str()` is only guaranteed to return the data up to the first NUL
character.
src/netbase.cpp
patch
|
blob
|
history
diff --git
a/src/netbase.cpp
b/src/netbase.cpp
index
a9caddf
..
41dec48
100644
(file)
--- a/
src/netbase.cpp
+++ b/
src/netbase.cpp
@@
-252,7
+252,7
@@
bool static Socks5(string strDest, uint16_t port, SOCKET& hSocket)
strSocks5 += strDest;
strSocks5 += static_cast<char>((port >> 8) & 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())
{
CloseSocket(hSocket);