aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/src/Children.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/Children.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/Children.cpp')
-rw-r--r--nxcomp/src/Children.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/nxcomp/src/Children.cpp b/nxcomp/src/Children.cpp
index 9486f189a..e586292da 100644
--- a/nxcomp/src/Children.cpp
+++ b/nxcomp/src/Children.cpp
@@ -275,12 +275,14 @@ int NXTransDialog(const char *caption, const char *message,
#ifdef __APPLE__
+ // FIXME: missing length limitation!
strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:");
#endif
#ifdef __CYGWIN32__
+ // FIXME: missing length limitation!
strcat(newPath, ".:");
#endif
@@ -289,9 +291,8 @@ int NXTransDialog(const char *caption, const char *message,
char *oldPath = getenv("PATH");
- strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1);
-
- newPath[DEFAULT_STRING_LIMIT - 1] = '\0';
+ // FIXME: check if strncat would be better here
+ snprintf(newPath + newLength, DEFAULT_STRING_LIMIT - newLength, "%s", oldPath);
#ifdef WARNING
*logofs << "NXTransDialog: WARNING! Trying with path '"
@@ -427,17 +428,13 @@ int NXTransClient(const char* display)
#ifdef __sun
- snprintf(newDisplay, DISPLAY_LENGTH_LIMIT - 1, "DISPLAY=%s", display);
-
- newDisplay[DISPLAY_LENGTH_LIMIT - 1] = '\0';
+ snprintf(newDisplay, DISPLAY_LENGTH_LIMIT, "DISPLAY=%s", display);
putenv(newDisplay);
#else
- strncpy(newDisplay, display, DISPLAY_LENGTH_LIMIT - 1);
-
- newDisplay[DISPLAY_LENGTH_LIMIT - 1] = '\0';
+ snprintf(newDisplay, DISPLAY_LENGTH_LIMIT, "%s", display);
setenv("DISPLAY", newDisplay, 1);
@@ -467,6 +464,7 @@ int NXTransClient(const char* display)
if (i == 0)
{
+ // FIXME: code dpulication: this whole block is duplicated in NXTransDialog
strcpy(command, "nxclient");
char newPath[DEFAULT_STRING_LIMIT];
@@ -489,7 +487,8 @@ int NXTransClient(const char* display)
char *oldPath = getenv("PATH");
- strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1);
+ // FIXME: check if strncat would be better here
+ snprintf(newPath + newLength, DEFAULT_STRING_LIMIT - newLength, "%s", oldPath);
newPath[DEFAULT_STRING_LIMIT - 1] = '\0';