Skip to content

Commit

Permalink
[CBRD-24788] Add defense code to prevent core dump due to uninitializ…
Browse files Browse the repository at this point in the history
…ed pointer variable in csql (#4336)

http://jira.cubrid.org/browse/CBRD-24788

In csql, a pointer variable was declared but not initialized.
Since these uninitialized variables have garbage values, using these variables can cause a core dump.
Since this variable is used only in the for loop, it must be declared and initialized in the for loop.
  • Loading branch information
airnet73 authored May 3, 2023
1 parent 6606d03 commit 8f28ae9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/executables/csql.c
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,6 @@ csql_execute_statements (const CSQL_ARGUMENT * csql_arg, int type, const void *s
DB_QUERY_TYPE *attr_spec = NULL; /* result attribute spec. */
int total; /* number of statements to execute */
bool do_abort_transaction = false; /* flag for transaction abort */
PT_NODE *statement = NULL;
char sql_text[DDL_LOG_BUFFER_SIZE] = { 0 };

csql_Num_failures = 0;
Expand Down Expand Up @@ -1889,6 +1888,7 @@ csql_execute_statements (const CSQL_ARGUMENT * csql_arg, int type, const void *s
DB_QUERY_RESULT *result = NULL; /* result pointer */
int db_error;
char stmt_msg[LINE_BUFFER_SIZE];
PT_NODE *statement = NULL;

/* Start the execution of stms */
stmt_msg[0] = '\0';
Expand Down

0 comments on commit 8f28ae9

Please sign in to comment.