aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/src/Loop.cpp
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-12-27 13:16:35 +0100
committerUlrich Sibiller <uli42@gmx.de>2017-12-29 02:31:26 +0100
commit14a5589186c7cf0ececadedecd3db3125466d22a (patch)
treef890de32a15c57a643511bf21ae7c2e62e6cf304 /nxcomp/src/Loop.cpp
parent3066195d79f5f24f99483d29e2489a91c9251d73 (diff)
downloadnx-libs-14a5589186c7cf0ececadedecd3db3125466d22a.tar.gz
nx-libs-14a5589186c7cf0ececadedecd3db3125466d22a.tar.bz2
nx-libs-14a5589186c7cf0ececadedecd3db3125466d22a.zip
Loop.cpp: improve/fix usage of s(n)printf
Diffstat (limited to 'nxcomp/src/Loop.cpp')
-rw-r--r--nxcomp/src/Loop.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp
index e922b55a5..c6dc3fefe 100644
--- a/nxcomp/src/Loop.cpp
+++ b/nxcomp/src/Loop.cpp
@@ -3939,7 +3939,8 @@ void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
// this name cannot be changed as it is defined this way by the
// local X server
- int len = sprintf(unixSocketName + 1, "/tmp/.X11-unix/X%d", xPort);
+ int len = snprintf(unixSocketName + 1, DEFAULT_STRING_LENGTH - 1,
+ "/tmp/.X11-unix/X%d", xPort);
unixSocketName[0] = '\0';
sockaddr_un *xServerAddrABSTRACT = new sockaddr_un;
@@ -3977,7 +3978,7 @@ void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
char unixSocketDir[DEFAULT_STRING_LENGTH];
- snprintf(unixSocketDir, DEFAULT_STRING_LENGTH - 1, "/tmp/.X11-unix");
+ snprintf(unixSocketDir, DEFAULT_STRING_LENGTH, "/tmp/.X11-unix");
#ifdef __APPLE__
@@ -3990,7 +3991,7 @@ void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
*slash = '\0';
}
- snprintf(unixSocketDir, DEFAULT_STRING_LENGTH - 1, "%s", display);
+ snprintf(unixSocketDir, DEFAULT_STRING_LENGTH, "%s", display);
}
#endif
@@ -4019,7 +4020,8 @@ void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
HandleCleanup();
}
- sprintf(unixSocketName, "%s/X%d", unixSocketDir, xPort);
+ snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "%s/X%d",
+ unixSocketDir, xPort);
#ifdef __APPLE__