summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-05-31 09:36:28 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-05-31 10:59:46 +0200
commit33bf4f0bcf941ee4609f558442035514f54cbc8a (patch)
tree77bfd61a5b7d3b236a94e97fa488f1c688b25587 /sal/osl
parentc7f484eb774fc90cf8e1540a703c5c3856312ef2 (diff)
Replace inet_ntoa with inet_ntop
...as inet_ntoa is potentially not thread-safe; and add a test Change-Id: I9df945b006ba7194c3b1444c4886101c08339ad0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116425 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/unx/socket.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 376d6f1412ce..c78e43a9de93 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -1092,7 +1092,10 @@ oslSocketResult SAL_CALL osl_getDottedInetAddrOfSocketAddr(oslSocketAddr Addr, r
return osl_Socket_Error;
}
- rtl_uString_newFromAscii(ustrDottedInetAddr,inet_ntoa(pSystemInetAddr->sin_addr));
+ char buf[INET_ADDRSTRLEN];
+ auto const text = inet_ntop(AF_INET, &pSystemInetAddr->sin_addr, buf, INET_ADDRSTRLEN);
+ assert(text != nullptr);
+ rtl_uString_newFromAscii(ustrDottedInetAddr,text);
return osl_Socket_Ok;