From f5e757d71f1c19cefd08455c6fa4ef815fb764c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Frohm=C3=BCller?= Date: Wed, 7 Dec 2022 12:48:07 +0100 Subject: [PATCH] Small bugfix. get_full_line_ccc and get_rest_of_line_ccc were returning a pointer to invalidated memory. --- src/opensuperclone/tool.c | 6 ++++-- src/opensuperclone/tool.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/opensuperclone/tool.c b/src/opensuperclone/tool.c index aed193c..9a68627 100644 --- a/src/opensuperclone/tool.c +++ b/src/opensuperclone/tool.c @@ -1594,7 +1594,8 @@ int find_command_plus1_ccc(char *search_command, char *search_command_cap, char // function to return a full line char *get_full_line_ccc(unsigned int line_number) { - char full_line[MAX_LINE_LENGTH] = ""; + //char full_line[MAX_LINE_LENGTH] = ""; + full_line[0] = '\0'; sscanf(script_line_pointer_ccc[line_number], "%[^\n]", full_line); char *return_data = full_line; return (return_data); @@ -1604,7 +1605,8 @@ char *get_full_line_ccc(unsigned int line_number) char *get_rest_of_line(unsigned int line_number) { char command[MAX_COMMAND_LENGTH] = ""; - char rest_of_line[MAX_LINE_LENGTH] = ""; + //char rest_of_line[MAX_LINE_LENGTH] = ""; + rest_of_line[0] = '\0'; sscanf(script_line_pointer_ccc[line_number], "%s %[^\n]", command, rest_of_line); char *return_data = rest_of_line; return (return_data); diff --git a/src/opensuperclone/tool.h b/src/opensuperclone/tool.h index 87428ae..56d907f 100644 --- a/src/opensuperclone/tool.h +++ b/src/opensuperclone/tool.h @@ -27,6 +27,8 @@ char *string_variable_name_buffer_ccc; char **string_variable_name_pointer_ccc; char *string_variable_buffer_ccc; unsigned int total_string_variables_ccc; +char full_line[MAX_LINE_LENGTH] = ""; +char rest_of_line[MAX_LINE_LENGTH] = ""; void supertool_cleanup_ccc(void);