This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 2e21bd015b38f6fec1abcf414c8c96306ee68405
Author: Mihai Moldovan <io...@ionic.de>
Date:   Wed Mar 18 05:51:03 2015 +0100

    x2goclient.cpp: create new argv array on the heap instead of on the stack.
    
    Stack data will be invalid once the function goes out of scope (which is
    what execv is doing.)
---
 debian/changelog   |    3 +++
 src/x2goclient.cpp |   12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index dc5e8c8..4dd92c5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -44,6 +44,9 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
       after fork on virtually all operating system, especially on OS X.
     - x2goclient.cpp: fix compile problems introduced with the last commit.
     - x2goclient.cpp: fix string comparison.
+    - x2goclient.cpp: create new argv array on the heap instead of on the
+      stack. Stack data will be invalid once the function goes out of scope
+      (which is what execv is doing.)
 
  -- X2Go Release Manager <git-ad...@x2go.org>  Mon, 19 Sep 2016 09:07:07 +0200
 
diff --git a/src/x2goclient.cpp b/src/x2goclient.cpp
index eee541f..c8df342 100644
--- a/src/x2goclient.cpp
+++ b/src/x2goclient.cpp
@@ -47,20 +47,20 @@ int fork_helper (int argc, char **argv) {
     new_argv.push_back (std::string (argv[0]));
     new_argv.push_back ("--unixhelper");
 
-    std::vector<char *> new_argv_c_str;
+    std::vector<char *> *new_argv_c_str = new (std::vector<char *>) ();
     for (std::vector<std::string>::iterator it = new_argv.begin (); it != 
new_argv.end (); ++it) {
       const char *elem = (*it).c_str ();
-      new_argv_c_str.push_back (strndup (elem, std::strlen (elem)));
+      new_argv_c_str->push_back (strndup (elem, std::strlen (elem)));
     }
 
     /* Add null pointer as last element. */
     {
-      std::vector<char> tmp;
-      tmp.push_back (0);
-      new_argv_c_str.push_back (&tmp.front ());
+      std::vector<char> *tmp = new (std::vector<char>) ();
+      tmp->push_back (0);
+      new_argv_c_str->push_back (&tmp->front ());
     }
 
-    if (0 != execv (new_argv_c_str.front (), &(new_argv_c_str.front ()))) {
+    if (0 != execv (new_argv_c_str->front (), &(new_argv_c_str->front ()))) {
       std::cerr << "Failed to re-execute process as UNIX cleanup helper tool: 
" << std::strerror (errno) << "\n"
                 << "Terminating and killing parent." << "\n"
                 << "Please report a bug, refer to this documentation: 
http://wiki.x2go.org/doku.php/wiki:bugs"; << std::endl;

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email 
on /srv/git/code.x2go.org/x2goclient.git
_______________________________________________
x2go-commits mailing list
x2go-commits@lists.x2go.org
http://lists.x2go.org/listinfo/x2go-commits

Reply via email to