Merge pull request #5861 from Icinga/fix/invalid-memory-access

Fix incorrect memory access
This commit is contained in:
Gunnar Beutner 2017-12-15 06:25:10 +01:00 committed by GitHub
commit 85f3865718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -634,7 +634,10 @@ void Application::AttachDebugger(const String& filename, bool interactive)
my_pid_str,
nullptr
};
argv = const_cast<char **>(uargv);
(void) execvp(argv[0], argv);
} else {
const char *uargv[] = {
"gdb",
@ -649,10 +652,12 @@ void Application::AttachDebugger(const String& filename, bool interactive)
"quit",
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);