]> granicus.if.org Git - icinga2/commitdiff
Merge pull request #5861 from Icinga/fix/invalid-memory-access
authorGunnar Beutner <gunnar@beutner.name>
Fri, 15 Dec 2017 05:25:10 +0000 (06:25 +0100)
committerGitHub <noreply@github.com>
Fri, 15 Dec 2017 05:25:10 +0000 (06:25 +0100)
Fix incorrect memory access

1  2 
lib/base/application.cpp

index 790eae905f363c66c8c524ec12c14cc3ac942821,87f0ca8b136b75095b6c1a96d00491fbb6684ee1..785d8c0b0d614bae0b96a6b3c406d3f7e6ca9fa4
@@@ -632,9 -632,12 +632,12 @@@ void Application::AttachDebugger(const 
                                "gdb",
                                "-p",
                                my_pid_str,
 -                              NULL
 +                              nullptr
                        };
                        argv = const_cast<char **>(uargv);
+                       (void) execvp(argv[0], argv);
                } else {
                        const char *uargv[] = {
                                "gdb",
                                "detach",
                                "-ex",
                                "quit",
 -                              NULL
 +                              nullptr
                        };
                        argv = const_cast<char **>(uargv);
+                       (void) execvp(argv[0], argv);
                }
  
-               (void)execvp(argv[0], argv);
                perror("Failed to launch GDB");
                free(my_pid_str);
                _exit(0);