aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/src/Auth.cpp
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2017-12-30 03:31:20 +0100
committerMihai Moldovan <ionic@ionic.de>2017-12-30 03:31:20 +0100
commite13e31f752c0b204f964ee1df272a6b31ce51189 (patch)
treed3bc2368895d03487b994fedff953ac457c4acc0 /nxcomp/src/Auth.cpp
parent2d44051aad601e074790eaf482ef09090131ca5d (diff)
parent367bec59524ffc3d005ae8908c5edf42e9b01ca7 (diff)
downloadnx-libs-e13e31f752c0b204f964ee1df272a6b31ce51189.tar.gz
nx-libs-e13e31f752c0b204f964ee1df272a6b31ce51189.tar.bz2
nx-libs-e13e31f752c0b204f964ee1df272a6b31ce51189.zip
Merge branch 'uli42-pr/fix_abstract' into 3.6.x
Attributes GH PR #615: https://github.com/ArcticaProject/nx-libs/pull/615 Fixes: ArcticaProject/nx-libs#612 Fixes: ArcticaProject/nx-libs#572
Diffstat (limited to 'nxcomp/src/Auth.cpp')
-rw-r--r--nxcomp/src/Auth.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/nxcomp/src/Auth.cpp b/nxcomp/src/Auth.cpp
index d398f5f85..87955f6ab 100644
--- a/nxcomp/src/Auth.cpp
+++ b/nxcomp/src/Auth.cpp
@@ -212,16 +212,14 @@ int Auth::getCookie()
if (environment != NULL && *environment != '\0')
{
- strncpy(file_, environment, DEFAULT_STRING_LIMIT - 1);
+ snprintf(file_, DEFAULT_STRING_LIMIT, "%s", environment);
}
else
{
- snprintf(file_, DEFAULT_STRING_LIMIT - 1, "%s/.Xauthority",
+ snprintf(file_, DEFAULT_STRING_LIMIT, "%s/.Xauthority",
control -> HomePath);
}
- *(file_ + DEFAULT_STRING_LIMIT - 1) = '\0';
-
#ifdef TEST
*logofs << "Auth: Using X authorization file '" << file_
<< "'.\n" << logofs_flush;
@@ -242,18 +240,14 @@ int Auth::getCookie()
#if defined(__CYGWIN32__)
- snprintf(command, DEFAULT_STRING_LIMIT - 1,
+ snprintf(command, DEFAULT_STRING_LIMIT,
"%s/bin/nxauth", control -> SystemPath);
- *(command + DEFAULT_STRING_LIMIT - 1) = '\0';
-
#elif defined(__APPLE__)
- snprintf(command, DEFAULT_STRING_LIMIT - 1,
+ snprintf(command, DEFAULT_STRING_LIMIT,
"%s/nxauth", control -> SystemPath);
- *(command + DEFAULT_STRING_LIMIT - 1) = '\0';
-
#else
strcpy(command, "xauth");