summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorobs <D:\Data\AppData\Roaming\The Bat!>2019-04-14 14:34:06 +0200
committerGeorge Hazan <ghazan@miranda.im>2019-04-14 16:56:05 +0300
commitd65c5b1a12841c62376e6481c87ffb6b4e3e6bd8 (patch)
tree49a79358564af929f3abf0c2f4bb79928e7a0ca5
parent31aec878c07125c3ba4e68bc854c5240af0ccdca (diff)
Netlib_AddressToString expects input in network byte order (fixes issue #1764)
-rw-r--r--protocols/JabberG/src/jabber_byte.cpp2
-rw-r--r--protocols/JabberG/src/jabber_file.cpp2
-rw-r--r--src/mir_app/src/netlibsock.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp
index c72ebaaea6..fe2aaed8fd 100644
--- a/protocols/JabberG/src/jabber_byte.cpp
+++ b/protocols/JabberG/src/jabber_byte.cpp
@@ -211,7 +211,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
if (localAddr == nullptr) {
sockaddr_in sin = {};
sin.sin_family = AF_INET;
- sin.sin_addr.S_un.S_addr = nlb.dwExternalIP;
+ sin.sin_addr.S_un.S_addr = htonl(nlb.dwExternalIP);
localAddr = Netlib_AddressToString(&sin);
}
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index f9909972f0..1cb53aa248 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -288,7 +288,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
if (myAddr == nullptr) {
sockaddr_in sin = {};
sin.sin_family = AF_INET;
- sin.sin_addr.S_un.S_addr = nlb.dwExternalIP;
+ sin.sin_addr.S_un.S_addr = htonl(nlb.dwExternalIP);
myAddr = Netlib_AddressToString(&sin);
}
diff --git a/src/mir_app/src/netlibsock.cpp b/src/mir_app/src/netlibsock.cpp
index a2cbfbe5a1..afe705d98d 100644
--- a/src/mir_app/src/netlibsock.cpp
+++ b/src/mir_app/src/netlibsock.cpp
@@ -200,7 +200,7 @@ MIR_APP_DLL(char*) Netlib_AddressToString(sockaddr_in *addr)
if (addr->sin_family == AF_INET) {
char *szIp = inet_ntoa(addr->sin_addr);
if (addr->sin_port != 0) {
- mir_snprintf(saddr, "%s:%d", szIp, htons(addr->sin_port));
+ mir_snprintf(saddr, "%s:%d", szIp, addr->sin_port);
return mir_strdup(saddr);
}
return mir_strdup(szIp);