From b75a8f795fc1ea7a4604c09d65d91a75ddbbbbea Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 31 Oct 2009 03:38:39 +0100 Subject: src/CLI/*: fix an unterminated argv + simplifications The fix is: - const char *args[6]; - args[0] = editor; - args[1] = path; + char *args[3]; + args[0] = (char*)editor; + args[1] = (char*)path; + args[2] = NULL; run_command(args); Signed-off-by: Denys Vlasenko --- src/Hooks/abrt-pyhook-helper.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Hooks/abrt-pyhook-helper.cpp') diff --git a/src/Hooks/abrt-pyhook-helper.cpp b/src/Hooks/abrt-pyhook-helper.cpp index f8bda84..7a4ffc8 100644 --- a/src/Hooks/abrt-pyhook-helper.cpp +++ b/src/Hooks/abrt-pyhook-helper.cpp @@ -1,5 +1,5 @@ /* - python-hook-writer.cpp - writes data to the /var/cache/abrt directory + python-hook-writer.cpp - writes data to the /var/cache/abrt directory with SUID bit Copyright (C) 2009 RedHat inc. @@ -26,7 +26,7 @@ #if HAVE_CONFIG_H #include #endif - + const char *argp_program_version = "abrt-pyhook-helper " VERSION; const char *argp_program_bug_address = ""; @@ -56,7 +56,7 @@ parse_opt (int key, char *arg, struct argp_state *state) /* Get the input argument from argp_parse, which we know is a pointer to our arguments structure. */ struct arguments *arguments = (struct arguments*)state->input; - + switch (key) { case 'p': arguments->pid = arg; break; @@ -77,7 +77,7 @@ parse_opt (int key, char *arg, struct argp_state *state) exit(1); } break; - + default: return ARGP_ERR_UNKNOWN; } @@ -113,7 +113,7 @@ int main(int argc, char** argv) fprintf(stderr, "Backtrace size limit exceeded. Trimming to 1 MB.\n"); break; } - + bt = (char*)realloc(bt, capacity); if (!bt) { @@ -126,7 +126,7 @@ int main(int argc, char** argv) // Create directory with the debug dump. char path[PATH_MAX]; - snprintf(path, sizeof(path), "%s/pyhook-%ld-%s", DEBUG_DUMPS_DIR, + snprintf(path, sizeof(path), "%s/pyhook-%ld-%s", DEBUG_DUMPS_DIR, (long)time(NULL), arguments.pid); CDebugDump dd; -- cgit