ports/x11/nx/nxcomp/patches/patch-Loop_cpp

60 lines
2 KiB
Text

- fix bounds length warnings
- fix bind namespacing
Index: Loop.cpp
--- Loop.cpp.orig
+++ Loop.cpp
@@ -3770,7 +3770,7 @@ int SetupAuthInstance()
launchdAddrUnix.sun_family = AF_UNIX;
- const int launchdAddrNameLength = 108;
+ const int launchdAddrNameLength = SUN_LEN(&launchdAddrUnix);
int success = -1;
@@ -3961,7 +3961,7 @@ int SetupTcpSocket()
tcpAddr.sin_port = htons(proxyPortTCP);
tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- if (bind(tcpFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
+ if (::bind(tcpFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
{
#ifdef PANIC
*logofs << "Loop: PANIC! Call to bind failed for TCP port "
@@ -4037,7 +4037,7 @@ int SetupUnixSocket()
snprintf(unixSocketName, DEFAULT_STRING_LENGTH - 1, "%s/X%d",
dirName, proxyPort);
- strncpy(unixAddr.sun_path, unixSocketName, 108);
+ strncpy(unixAddr.sun_path, unixSocketName, SUN_LEN(&unixAddr));
#ifdef TEST
*logofs << "Loop: Assuming Unix socket with name '"
@@ -4047,7 +4047,7 @@ int SetupUnixSocket()
*(unixAddr.sun_path + 107) = '\0';
- if (bind(unixFD, (sockaddr *) &unixAddr, sizeof(unixAddr)) == -1)
+ if (::bind(unixFD, (sockaddr *) &unixAddr, sizeof(unixAddr)) == -1)
{
#ifdef PANIC
*logofs << "Loop: PANIC! Call to bind failed for UNIX domain socket "
@@ -4514,7 +4514,7 @@ int ListenConnection(int port, const char *label)
tcpAddr.sin_port = htons(portTCP);
tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- if (bind(newFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
+ if (::bind(newFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
{
#ifdef PANIC
*logofs << "Loop: PANIC! Call to bind failed for " << label
@@ -6703,7 +6703,7 @@ int WaitForRemote(int portNum)
#endif
- if (bind(proxyFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
+ if (::bind(proxyFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
{
#ifdef PANIC
*logofs << "Loop: PANIC! Call to bind failed for TCP port "