aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/src/Auth.cpp
diff options
context:
space:
mode:
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");