diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2023-03-31 21:32:41 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2023-03-31 21:32:41 +0200 |
commit | ac5a534a4caa6c86762e721dfe7183be2fee29ca (patch) | |
tree | a3d40e82beeef165e5965aec282a458b1febf23a /client | |
parent | e093e5abbed1a7883b8a78935c11505bd0bcb0d6 (diff) | |
parent | eaebe8b5600b144c51a9405de42a70bd4b710987 (diff) | |
download | mariadb-git-ac5a534a4caa6c86762e721dfe7183be2fee29ca.tar.gz |
Merge remote-tracking branch '10.4' into 10.5
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 1 | ||||
-rw-r--r-- | client/mysql_plugin.c | 112 | ||||
-rw-r--r-- | client/mysql_upgrade.c | 17 | ||||
-rw-r--r-- | client/mysqladmin.cc | 3 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 29 | ||||
-rw-r--r-- | client/mysqlcheck.c | 1 | ||||
-rw-r--r-- | client/mysqldump.c | 33 | ||||
-rw-r--r-- | client/mysqlslap.c | 8 | ||||
-rw-r--r-- | client/mysqltest.cc | 10 |
9 files changed, 125 insertions, 89 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index b1d2bc8def6..e47527af390 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -5369,6 +5369,7 @@ static void init_username() full_username=my_strdup(PSI_NOT_INSTRUMENTED, cur[0],MYF(MY_WME)); part_username=my_strdup(PSI_NOT_INSTRUMENTED, strtok(cur[0],"@"),MYF(MY_WME)); (void) mysql_fetch_row(result); // Read eof + mysql_free_result(result); } } diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index f6a08558722..73fa43752a9 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -102,7 +102,7 @@ int main(int argc,char *argv[]) MY_INIT(argv[0]); sf_leaking_memory=1; /* don't report memory leaks on early exits */ plugin_data.name= 0; /* initialize name */ - + /* The following operations comprise the method for enabling or disabling a plugin. We begin by processing the command options then check the @@ -110,15 +110,15 @@ int main(int argc,char *argv[]) --plugin-ini (if specified). If the directories are Ok, we then look for the mysqld executable and the plugin soname. Finally, we build a bootstrap command file for use in bootstraping the server. - + If any step fails, the method issues an error message and the tool exits. - + 1) Parse, execute, and verify command options. 2) Check access to directories. 3) Look for mysqld executable. 4) Look for the plugin. 5) Build a bootstrap file with commands to enable or disable plugin. - + */ if ((error= process_options(argc, argv, operation)) || (error= check_access()) || @@ -126,11 +126,11 @@ int main(int argc,char *argv[]) (error= find_plugin(tp_path)) || (error= build_bootstrap_file(operation, bootstrap))) goto exit; - + /* Dump the bootstrap file if --verbose specified. */ if (opt_verbose && ((error= dump_bootstrap_file(bootstrap)))) goto exit; - + /* Start the server in bootstrap mode and execute bootstrap commands */ error= bootstrap_server(server_path, bootstrap); @@ -238,7 +238,7 @@ static int run_command(char* cmd, const char *mode) #ifdef __WIN__ /** Check to see if there are spaces in a path. - + @param[in] path The Windows path to examine. @retval int spaces found = 1, no spaces = 0 @@ -253,7 +253,7 @@ static int has_spaces(const char *path) /** Convert a Unix path to a Windows path. - + @param[in] path The Windows path to examine. @returns string containing path with / changed to \\ @@ -335,12 +335,12 @@ static int get_default_values() #ifdef __WIN__ { char *format_str= 0; - + if (has_spaces(tool_path) || has_spaces(defaults_file)) format_str = "\"%s --mysqld > %s\""; else format_str = "%s --mysqld > %s"; - + snprintf(defaults_cmd, sizeof(defaults_cmd), format_str, add_quotes(tool_path), add_quotes(defaults_file)); if (opt_verbose) @@ -675,7 +675,7 @@ static int load_plugin_data(char *plugin_name, char *config_file) { reason= "Bad format in plugin configuration file."; fclose(file_ptr); - goto error; + goto error; } break; } @@ -709,7 +709,7 @@ static int load_plugin_data(char *plugin_name, char *config_file) } } } - + fclose(file_ptr); return 0; @@ -740,7 +740,7 @@ static int check_options(int argc, char **argv, char *operation) int num_found= 0; /* number of options found (shortcut loop) */ char config_file[FN_REFLEN]; /* configuration file name */ char plugin_name[FN_REFLEN]; /* plugin name */ - + /* Form prefix strings for the options. */ const char *basedir_prefix = "--basedir="; size_t basedir_len= strlen(basedir_prefix); @@ -815,7 +815,7 @@ static int check_options(int argc, char **argv, char *operation) return 1; } /* If a plugin was specified, read the config file. */ - else if (strlen(plugin_name) > 0) + else if (strlen(plugin_name) > 0) { if (load_plugin_data(plugin_name, config_file)) { @@ -847,22 +847,22 @@ static int check_options(int argc, char **argv, char *operation) /** Parse, execute, and verify command options. - + This method handles all of the option processing including the optional features for displaying data (--print-defaults, --help ,etc.) that do not result in an attempt to ENABLE or DISABLE of a plugin. - + @param[in] arc Count of arguments @param[in] argv Array of arguments @param[out] operation Operation (ENABLE or DISABLE) - + @retval int error = 1, success = 0, exit program = -1 */ static int process_options(int argc, char *argv[], char *operation) { int error= 0; - + /* Parse and execute command-line options */ if ((error= handle_options(&argc, &argv, my_long_options, get_one_option))) return error; @@ -881,7 +881,7 @@ static int process_options(int argc, char *argv[], char *operation) char buff[FN_REFLEN]; if (basedir_len + 2 > FN_REFLEN) return -1; - + memcpy(buff, opt_basedir, basedir_len); buff[basedir_len]= '/'; buff[basedir_len + 1]= '\0'; @@ -890,7 +890,7 @@ static int process_options(int argc, char *argv[], char *operation) opt_basedir= my_strdup(PSI_NOT_INSTRUMENTED, buff, MYF(MY_FAE)); } } - + /* If the user did not specify the option to skip loading defaults from a config file and the required options are not present or there was an error @@ -925,18 +925,18 @@ static int process_options(int argc, char *argv[], char *operation) /** Check access - + This method checks to ensure all of the directories (opt_basedir, opt_plugin_dir, opt_datadir, and opt_plugin_ini) are accessible by the user. - + @retval int error = 1, success = 0 */ static int check_access() { int error= 0; - + if ((error= my_access(opt_basedir, F_OK))) { fprintf(stderr, "ERROR: Cannot access basedir at '%s'.\n", @@ -1048,13 +1048,13 @@ static int find_plugin(char *tp_path) /** Build the bootstrap file. - + Create a new file and populate it with SQL commands to ENABLE or DISABLE the plugin via REPLACE and DELETE operations on the mysql.plugin table. param[in] operation The type of operation (ENABLE or DISABLE) param[out] bootstrap A FILE* pointer - + @retval int error = 1, success = 0 */ @@ -1062,7 +1062,7 @@ static int build_bootstrap_file(char *operation, char *bootstrap) { int error= 0; FILE *file= 0; - + /* Perform plugin operation : ENABLE or DISABLE @@ -1073,10 +1073,10 @@ static int build_bootstrap_file(char *operation, char *bootstrap) <plugin_name>.ini configuration file. Once the file is built, a call to mysqld is made in read only, bootstrap modes to read the SQL statements and execute them. - + Note: Replace was used so that if a user loads a newer version of a library with a different library name, the new library name is - used for symbols that match. + used for symbols that match. */ if ((error= make_tempfile(bootstrap, "sql"))) { @@ -1123,7 +1123,7 @@ static int build_bootstrap_file(char *operation, char *bootstrap) printf("# Disabling %s...\n", plugin_data.name); } } - + exit: fclose(file); return error; @@ -1132,11 +1132,11 @@ exit: /** Dump bootstrap file. - + Read the contents of the bootstrap file and print it out. - + @param[in] bootstrap_file Name of bootstrap file to read - + @retval int error = 1, success = 0 */ @@ -1173,7 +1173,7 @@ exit: /** Bootstrap the server - + Create a command line sequence to launch mysqld in bootstrap mode. This will allow mysqld to launch a minimal server instance to read and execute SQL commands from a file piped in (the bootstrap file). We use @@ -1194,47 +1194,39 @@ exit: static int bootstrap_server(char *server_path, char *bootstrap_file) { - char bootstrap_cmd[FN_REFLEN]; + char bootstrap_cmd[FN_REFLEN]= {0}; + char lc_messages_dir_str[FN_REFLEN]= {0}; int error= 0; #ifdef __WIN__ char *format_str= 0; const char *verbose_str= NULL; - - +#endif + + if (opt_lc_messages_dir != NULL) + snprintf(lc_messages_dir_str, sizeof(lc_messages_dir_str), "--lc-messages-dir=%s", + opt_lc_messages_dir); + +#ifdef __WIN__ if (opt_verbose) verbose_str= "--console"; else verbose_str= ""; + if (has_spaces(opt_datadir) || has_spaces(opt_basedir) || - has_spaces(bootstrap_file)) - { - if (opt_lc_messages_dir != NULL) - format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s --lc-messages-dir=%s <%s\""; - else - format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s <%s\""; - } + has_spaces(bootstrap_file) || has_spaces(lc_messages_dir_str)) + format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s %s <%s\""; else - { - if (opt_lc_messages_dir != NULL) - format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s --lc-messages-dir=%s <%s\""; - else - format_str= "%s %s --bootstrap --datadir=%s --basedir=%s <%s"; - } + format_str= "%s %s --bootstrap --datadir=%s --basedir=%s %s <%s"; + snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), format_str, add_quotes(convert_path(server_path)), verbose_str, add_quotes(opt_datadir), add_quotes(opt_basedir), - add_quotes(bootstrap_file)); + add_quotes(lc_messages_dir_str), add_quotes(bootstrap_file)); #else - if (opt_lc_messages_dir != NULL) - snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), - "%s --no-defaults --bootstrap --datadir=%s --basedir=%s --lc-messages-dir=%s" - " <%s", server_path, opt_datadir, opt_basedir, opt_lc_messages_dir, bootstrap_file); - else - snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), - "%s --no-defaults --bootstrap --datadir=%s --basedir=%s" - " <%s", server_path, opt_datadir, opt_basedir, bootstrap_file); - + snprintf(bootstrap_cmd, sizeof(bootstrap_cmd), + "%s --no-defaults --bootstrap --datadir=%s --basedir=%s %s" + " <%s", server_path, opt_datadir, opt_basedir, lc_messages_dir_str, bootstrap_file); #endif /* Execute the command */ @@ -1247,6 +1239,6 @@ static int bootstrap_server(char *server_path, char *bootstrap_file) fprintf(stderr, "ERROR: Unexpected result from bootstrap. Error code: %d.\n", error); - + return error; } diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index ad54b06101e..598045a013b 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -76,6 +76,8 @@ char upgrade_from_version[sizeof("10.20.456-MariaDB")+30]; static my_bool opt_write_binlog; +static void print_conn_args(const char *tool_name); + #define OPT_SILENT OPT_MAX_CLIENT_OPTION static struct my_option my_long_options[]= @@ -155,7 +157,10 @@ static struct my_option my_long_options[]= GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"user", 'u', "User for login.", &opt_user, &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"verbose", 'v', "Display more output about the process; Using it twice will print connection argument; Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase.", + {"verbose", 'v', "Display more output about the process; Using it twice will print connection argument;" + "Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase;" + "Using it 4 times (added in MariaDB 10.0.14) will also write out all mariadb-check commands used;" + "Using it 5 times will print all the mariadb commands used and their results while running mysql_fix_privilege_tables script.", &opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -210,6 +215,7 @@ static void die(const char *fmt, ...) DBUG_ENTER("die"); /* Print the error message */ + print_conn_args("mariadb-check"); fflush(stdout); va_start(args, fmt); if (fmt) @@ -640,6 +646,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res, "--database=mysql", "--batch", /* Turns off pager etc. */ force ? "--force": "--skip-force", + opt_verbose >= 5 ? "--verbose" : "", ds_res || opt_silent ? "--silent": "", "<", query_file_path, @@ -866,8 +873,7 @@ static int upgrade_already_done(int silent) "There is no need to run mysql_upgrade again for %s.", upgrade_from_version, version); if (!opt_check_upgrade) - verbose("You can use --force if you still want to run mysql_upgrade", - upgrade_from_version, version); + verbose("You can use --force if you still want to run mysql_upgrade"); } return 0; } @@ -1329,9 +1335,7 @@ static int run_sql_fix_privilege_tables(void) dynstr_append(&ds_script, *query_ptr); } - run_query(ds_script.str, - &ds_result, /* Collect result */ - TRUE); + run_query(ds_script.str, (opt_verbose >= 5) ? NULL : &ds_result, TRUE); { /* @@ -1502,6 +1506,7 @@ int main(int argc, char **argv) DBUG_ASSERT(phase == phases_total); end: + print_conn_args("mariadb-check"); free_used_memory(); my_end(my_end_arg); exit(0); diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 85043f03b53..8f29c83a441 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1593,7 +1593,8 @@ static void print_relative_row_vert(MYSQL_RES *result __attribute__((unused)), llstr((tmp - last_values[row]), buff)); /* Find the minimum row length needed to output the relative value */ - if ((length=(uint) strlen(buff) > ex_val_max_len[row]) && ex_status_printed) + length=(uint) strlen(buff); + if (length > ex_val_max_len[row] && ex_status_printed) ex_val_max_len[row] = length; last_values[row] = tmp; } diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index ced13b402b0..9dd31c14e81 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1832,15 +1832,20 @@ static void cleanup() my_free_open_file_info(); load_processor.destroy(); mysql_server_end(); + if (opt_flashback) + { + delete_dynamic(&binlog_events); + delete_dynamic(&events_in_stmt); + } DBUG_VOID_RETURN; } -static void die() +static void die(int err) { cleanup(); my_end(MY_DONT_FREE_DBUG); - exit(1); + exit(err); } @@ -1877,7 +1882,7 @@ static my_time_t convert_str_to_timestamp(const char* str) l_time.time_type != MYSQL_TIMESTAMP_DATETIME || status.warnings) { error("Incorrect date and time argument: %s", str); - die(); + die(1); } /* Note that Feb 30th, Apr 31st cause no error messages and are mapped to @@ -1940,7 +1945,7 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) opt->name)) <= 0) { sf_leaking_memory= 1; /* no memory leak reports here */ - die(); + die(1); } break; #ifdef WHEN_FLASHBACK_REVIEW_READY @@ -1961,7 +1966,7 @@ get_one_option(const struct my_option *opt, const char *argument, const char *) opt->name)) <= 0) { sf_leaking_memory= 1; /* no memory leak reports here */ - die(); + die(1); } opt_base64_output_mode= (enum_base64_output_mode)(val - 1); break; @@ -2046,7 +2051,7 @@ static int parse_args(int *argc, char*** argv) if ((ho_error=handle_options(argc, argv, my_options, get_one_option))) { - die(); + die(ho_error); } if (debug_info_flag) my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; @@ -3003,6 +3008,12 @@ int main(int argc, char** argv) my_set_max_open_files(open_files_limit); + if (opt_flashback && opt_raw_mode) + { + error("The --raw mode is not allowed with --flashback mode"); + die(1); + } + if (opt_flashback) { my_init_dynamic_array(PSI_NOT_INSTRUMENTED, &binlog_events, @@ -3018,7 +3029,7 @@ int main(int argc, char** argv) if (!remote_opt) { error("The --raw mode only works with --read-from-remote-server"); - die(); + die(1); } if (one_database) warning("The --database option is ignored in raw mode"); @@ -3040,7 +3051,7 @@ int main(int argc, char** argv) O_WRONLY | O_BINARY, MYF(MY_WME)))) { error("Could not create log file '%s'", result_file_name); - die(); + die(1); } } else @@ -3129,7 +3140,7 @@ int main(int argc, char** argv) /* Set delimiter back to semicolon */ if (retval != ERROR_STOP) { - if (!stop_event_string.is_empty()) + if (!stop_event_string.is_empty() && result_file) fprintf(result_file, "%s", stop_event_string.ptr()); if (!opt_raw_mode && opt_flashback) fprintf(result_file, "DELIMITER ;\n"); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 147ebb81231..0803aa3224d 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -947,6 +947,7 @@ static int handle_request_for_tables(char *tables, size_t length, DBUG_RETURN(1); if (dont_quote) { + DBUG_ASSERT(op); DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size); /* No backticks here as we added them before */ diff --git a/client/mysqldump.c b/client/mysqldump.c index e236fdf82f2..d649684b9d7 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2527,7 +2527,10 @@ static uint dump_events_for_db(char *db) /* Get database collation. */ if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name))) + { + mysql_free_result(event_list_res); DBUG_RETURN(1); + } } if (switch_character_set_results(mysql, "binary")) @@ -3329,7 +3332,10 @@ static uint get_table_structure(const char *table, const char *db, char *table_t if (path) { if (!(sql_file= open_sql_file_for_table(table, O_WRONLY))) + { + mysql_free_result(result); DBUG_RETURN(0); + } write_header(sql_file, db); } @@ -3730,7 +3736,7 @@ static int dump_triggers_for_table(char *table_name, char *db_name) char name_buff[NAME_LEN*4+3]; char query_buff[QUERY_LENGTH]; uint old_opt_compatible_mode= opt_compatible_mode; - MYSQL_RES *show_triggers_rs; + MYSQL_RES *show_triggers_rs= NULL; MYSQL_ROW row; FILE *sql_file= md_result_file; @@ -3814,8 +3820,6 @@ static int dump_triggers_for_table(char *table_name, char *db_name) } skip: - mysql_free_result(show_triggers_rs); - if (switch_character_set_results(mysql, default_charset)) goto done; @@ -3830,7 +3834,7 @@ skip: done: if (path) my_fclose(sql_file, MYF(0)); - + mysql_free_result(show_triggers_rs); DBUG_RETURN(ret); } @@ -3936,7 +3940,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, uint num_fields; size_t total_length, init_length; - MYSQL_RES *res; + MYSQL_RES *res= NULL; MYSQL_FIELD *field; MYSQL_ROW row; DBUG_ENTER("dump_table"); @@ -4130,6 +4134,8 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, fprintf(stderr,"%s: Error in field count for table: %s ! Aborting.\n", my_progname_short, result_table); error= EX_CONSCHECK; + if (!quick) + mysql_free_result(res); goto err; } @@ -4438,6 +4444,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, err: dynstr_free(&query_string); maybe_exit(error); + mysql_free_result(res); DBUG_VOID_RETURN; } /* dump_table */ @@ -4703,7 +4710,11 @@ static int dump_all_users_roles_and_grants() " '@', QUOTE(DEFAULT_ROLE_HOST))) as r," " CONCAT(QUOTE(mu.USER),'@',QUOTE(mu.HOST)) as u " "FROM mysql.user mu LEFT JOIN mysql.default_roles using (USER, HOST)")) + { + mysql_free_result(tableres); return 1; + } + while ((row= mysql_fetch_row(tableres))) { if (dump_grants(row[1])) @@ -5780,7 +5791,8 @@ static int get_sys_var_lower_case_table_names() lower_case_table_names= atoi(row[1]); mysql_free_result(table_res); } - + if (!row) + mysql_free_result(table_res); return lower_case_table_names; } @@ -6023,7 +6035,11 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos, } if (have_mariadb_gtid && get_gtid_pos(gtid_pos, 1)) + { + mysql_free_result(master); return 1; + } + } /* SHOW MASTER STATUS reports file and position */ @@ -6145,7 +6161,10 @@ static int do_show_slave_status(MYSQL *mysql_con, int use_gtid, { char gtid_pos[MAX_GTID_LENGTH]; if (have_mariadb_gtid && get_gtid_pos(gtid_pos, 0)) + { + mysql_free_result(slave); return 1; + } if (opt_comments) fprintf(md_result_file, "\n--\n-- Gtid position to start replication " "from\n--\n\n"); @@ -6341,7 +6360,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length, { const char *end= x + length; ulong found= 0; - uint find; + int find; char buff[255]; *err_pos= 0; /* No error yet */ diff --git a/client/mysqlslap.c b/client/mysqlslap.c index f5253533921..c27e3f4010d 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1773,6 +1773,7 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) uint x; struct timeval start_time, end_time; thread_context con; + int error; pthread_t mainthread; /* Thread descriptor */ pthread_attr_t attr; /* Thread attributes */ DBUG_ENTER("run_scheduler"); @@ -1781,8 +1782,11 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit) con.limit= limit; pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, - PTHREAD_CREATE_DETACHED); + if ((error= pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED))) + { + printf("Got error: %d from pthread_attr_setdetachstate\n", error); + exit(1); + } pthread_mutex_lock(&counter_mutex); thread_counter= 0; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 97a19f2128c..08e18be3f1b 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3564,9 +3564,11 @@ void do_system(struct st_command *command) /* returns TRUE if path is inside a sandbox */ bool is_sub_path(const char *path, size_t plen, const char *sandbox) { - size_t len= strlen(sandbox); - if (!sandbox || !len || plen <= len || memcmp(path, sandbox, len - 1) - || path[len] != '/') + size_t len; + if (!sandbox) + return false; + len= strlen(sandbox); + if (plen <= len || memcmp(path, sandbox, len-1) || path[len] != '/') return false; return true; } @@ -11752,7 +11754,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input, /* Sort array */ qsort(lines.buffer, lines.elements, - sizeof(char**), (qsort_cmp)comp_lines); + sizeof(uchar *), (qsort_cmp)comp_lines); /* Create new result */ for (i= 0; i < lines.elements ; i++) |