Commit 1a52767f authored by unknown's avatar unknown

Bug#26346: stack + buffer overrun in mysqldump

Fixes to buffer overlows from long command line args, and unchecked dyn_str return codes. Also light refactoring.


client/mysqldump.c:
  Bug#26346 stack + buffer overrun in mysqldump
mysql-test/r/mysqldump.result:
  Bug#26346 stack + buffer overrun in mysqldump
mysql-test/t/mysqldump.test:
  Bug#26346 stack + buffer overrun in mysqldump
parent ff07adae
...@@ -76,13 +76,13 @@ ...@@ -76,13 +76,13 @@
#define IGNORE_DATA 0x01 /* don't dump data for this table */ #define IGNORE_DATA 0x01 /* don't dump data for this table */
#define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */ #define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */
static char *add_load_option(char *ptr, const char *object, static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *statement); const char *option_value);
static ulong find_set(TYPELIB *lib, const char *x, uint length, static ulong find_set(TYPELIB *lib, const char *x, uint length,
char **err_pos, uint *err_len); char **err_pos, uint *err_len);
static char *alloc_query_str(ulong size); static char *alloc_query_str(ulong size);
static char *field_escape(char *to,const char *from,uint length); static void field_escape(DYNAMIC_STRING* in, const char *from);
static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
quick= 1, extended_insert= 1, quick= 1, extended_insert= 1,
lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0, lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0,
...@@ -121,6 +121,19 @@ FILE *md_result_file= 0; ...@@ -121,6 +121,19 @@ FILE *md_result_file= 0;
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;
#endif #endif
static uint opt_protocol= 0; static uint opt_protocol= 0;
/*
Dynamic_string wrapper functions. In this file use these
wrappers, they will terminate the process if there is
an allocation failure.
*/
static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
uint init_alloc, uint alloc_increment);
static void dynstr_append_checked(DYNAMIC_STRING* dest, const char* src);
static void dynstr_set_checked(DYNAMIC_STRING *str, const char *init_str);
static void dynstr_append_mem_checked(DYNAMIC_STRING *str, const char *append,
uint length);
static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size);
/* /*
Constant for detection of default value of default_charset. Constant for detection of default value of default_charset.
If default_charset is equal to mysql_universal_client_charset, then If default_charset is equal to mysql_universal_client_charset, then
...@@ -419,7 +432,9 @@ static struct my_option my_long_options[] = ...@@ -419,7 +432,9 @@ static struct my_option my_long_options[] =
static const char *load_default_groups[]= { "mysqldump","client",0 }; static const char *load_default_groups[]= { "mysqldump","client",0 };
static void safe_exit(int error); static void maybe_exit(int error);
static void die(int error, const char* reason, ...);
static void maybe_die(int error, const char* reason, ...);
static void write_header(FILE *sql_file, char *db_name); static void write_header(FILE *sql_file, char *db_name);
static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row, static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
const char *prefix,const char *name, const char *prefix,const char *name,
...@@ -474,11 +489,7 @@ static void verbose_msg(const char *fmt, ...) ...@@ -474,11 +489,7 @@ static void verbose_msg(const char *fmt, ...)
void check_io(FILE *file) void check_io(FILE *file)
{ {
if (ferror(file)) if (ferror(file))
{ die(EX_EOF, "Got errno %d on write", errno);
fprintf(stderr, "%s: Got errno %d on write\n", my_progname, errno);
ignore_errors= 0; /* We can't ignore this error */
safe_exit(EX_EOF);
}
} }
static void print_version(void) static void print_version(void)
...@@ -864,12 +875,74 @@ static int get_options(int *argc, char ***argv) ...@@ -864,12 +875,74 @@ static int get_options(int *argc, char ***argv)
static void DB_error(MYSQL *mysql_arg, const char *when) static void DB_error(MYSQL *mysql_arg, const char *when)
{ {
DBUG_ENTER("DB_error"); DBUG_ENTER("DB_error");
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname, maybe_die(EX_MYSQLERR, "Got error: %d: %s %s",
mysql_errno(mysql_arg), mysql_error(mysql_arg), when); mysql_errno(mysql_arg), mysql_error(mysql_arg), when);
fflush(stderr);
safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} /* DB_error */ }
/*
Prints out an error message and kills the process.
SYNOPSIS
die()
error_num - process return value
fmt_reason - a format string for use by my_vsnprintf.
... - variable arguments for above fmt_reason string
DESCRIPTION
This call prints out the formatted error message to stderr and then
terminates the process.
*/
static void die(int error_num, const char* fmt_reason, ...)
{
char buffer[1000];
va_list args;
va_start(args,fmt_reason);
my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args);
va_end(args);
fprintf(stderr, "%s: %s\n", my_progname, buffer);
fflush(stderr);
ignore_errors= 0; /* force the exit */
maybe_exit(error_num);
}
/*
Prints out an error message and maybe kills the process.
SYNOPSIS
maybe_die()
error_num - process return value
fmt_reason - a format string for use by my_vsnprintf.
... - variable arguments for above fmt_reason string
DESCRIPTION
This call prints out the formatted error message to stderr and then
terminates the process, unless the --force command line option is used.
This call should be used for non-fatal errors (such as database
errors) that the code may still be able to continue to the next unit
of work.
*/
static void maybe_die(int error_num, const char* fmt_reason, ...)
{
char buffer[1000];
va_list args;
va_start(args,fmt_reason);
my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args);
va_end(args);
fprintf(stderr, "%s: %s\n", my_progname, buffer);
fflush(stderr);
maybe_exit(error_num);
}
/* /*
...@@ -894,10 +967,8 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res, ...@@ -894,10 +967,8 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
if (mysql_query(mysql_con, query) || if (mysql_query(mysql_con, query) ||
(res && !((*res)= mysql_store_result(mysql_con)))) (res && !((*res)= mysql_store_result(mysql_con))))
{ {
fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n", maybe_die(EX_MYSQLERR, "Couldn't execute '%s': %s (%d)",
my_progname, query, query, mysql_error(mysql_con), mysql_errno(mysql_con));
mysql_error(mysql_con), mysql_errno(mysql_con));
safe_exit(EX_MYSQLERR);
return 1; return 1;
} }
return 0; return 0;
...@@ -942,7 +1013,7 @@ static void free_resources() ...@@ -942,7 +1013,7 @@ static void free_resources()
} }
static void safe_exit(int error) static void maybe_exit(int error)
{ {
if (!first_error) if (!first_error)
first_error= error; first_error= error;
...@@ -1002,10 +1073,7 @@ static int connect_to_db(char *host, char *user,char *passwd) ...@@ -1002,10 +1073,7 @@ static int connect_to_db(char *host, char *user,char *passwd)
my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */", my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */",
compatible_mode_normal_str); compatible_mode_normal_str);
if (mysql_query_with_error_report(mysql, 0, buff)) if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1); DBUG_RETURN(1);
}
/* /*
set time_zone to UTC to allow dumping date types between servers with set time_zone to UTC to allow dumping date types between servers with
different time zone settings different time zone settings
...@@ -1014,10 +1082,7 @@ static int connect_to_db(char *host, char *user,char *passwd) ...@@ -1014,10 +1082,7 @@ static int connect_to_db(char *host, char *user,char *passwd)
{ {
my_snprintf(buff, sizeof(buff), "/*!40103 SET TIME_ZONE='+00:00' */"); my_snprintf(buff, sizeof(buff), "/*!40103 SET TIME_ZONE='+00:00' */");
if (mysql_query_with_error_report(mysql, 0, buff)) if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1); DBUG_RETURN(1);
}
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} /* connect_to_db */ } /* connect_to_db */
...@@ -1038,10 +1103,8 @@ static void unescape(FILE *file,char *pos,uint length) ...@@ -1038,10 +1103,8 @@ static void unescape(FILE *file,char *pos,uint length)
char *tmp; char *tmp;
DBUG_ENTER("unescape"); DBUG_ENTER("unescape");
if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME)))) if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME))))
{ die(EX_MYSQLERR, "Couldn't allocate memory");
ignore_errors=0; /* Fatal error */
safe_exit(EX_MYSQLERR); /* Force exit */
}
mysql_real_escape_string(&mysql_connection, tmp, pos, length); mysql_real_escape_string(&mysql_connection, tmp, pos, length);
fputc('\'', file); fputc('\'', file);
fputs(tmp, file); fputs(tmp, file);
...@@ -1350,7 +1413,7 @@ static void print_blob_as_hex(FILE *output_file, const char *str, ulong len) ...@@ -1350,7 +1413,7 @@ static void print_blob_as_hex(FILE *output_file, const char *str, ulong len)
/* /*
dump_routines_for_db dump_routines_for_db
-- retrievs list of routines for a given db, and prints out -- retrieves list of routines for a given db, and prints out
the CREATE PROCEDURE definition into the output (the dump). the CREATE PROCEDURE definition into the output (the dump).
This function has logic to print the appropriate syntax depending on whether This function has logic to print the appropriate syntax depending on whether
...@@ -1545,11 +1608,10 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1545,11 +1608,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (!insert_pat_inited) if (!insert_pat_inited)
{ {
insert_pat_inited= 1; insert_pat_inited= 1;
if (init_dynamic_string(&insert_pat, "", 1024, 1024)) init_dynamic_string_checked(&insert_pat, "", 1024, 1024);
safe_exit(EX_MYSQLERR);
} }
else else
dynstr_set(&insert_pat, ""); dynstr_set_checked(&insert_pat, "");
} }
insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " : insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " :
...@@ -1581,18 +1643,13 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1581,18 +1643,13 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_snprintf(buff, sizeof(buff), "show create table %s", result_table); my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
if (mysql_query_with_error_report(mysql, 0, buff)) if (mysql_query_with_error_report(mysql, 0, buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
if (path) if (path)
{ {
if (!(sql_file= open_sql_file_for_table(table))) if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
write_header(sql_file, db); write_header(sql_file, db);
} }
if (!opt_xml && opt_comments) if (!opt_xml && opt_comments)
...@@ -1656,7 +1713,6 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1656,7 +1713,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
else else
...@@ -1719,7 +1775,6 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1719,7 +1775,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{ {
if (path) if (path)
my_fclose(sql_file, MYF(MY_WME)); my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1731,19 +1786,19 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1731,19 +1786,19 @@ static uint get_table_structure(char *table, char *db, char *table_type,
*/ */
if (write_data) if (write_data)
{ {
dynstr_append_mem(&insert_pat, "INSERT ", 7); dynstr_append_checked(&insert_pat, "INSERT ");
dynstr_append(&insert_pat, insert_option); dynstr_append_checked(&insert_pat, insert_option);
dynstr_append_mem(&insert_pat, "INTO ", 5); dynstr_append_checked(&insert_pat, "INTO ");
dynstr_append(&insert_pat, opt_quoted_table); dynstr_append_checked(&insert_pat, opt_quoted_table);
if (complete_insert) if (complete_insert)
{ {
dynstr_append_mem(&insert_pat, " (", 2); dynstr_append_checked(&insert_pat, " (");
} }
else else
{ {
dynstr_append_mem(&insert_pat, " VALUES ", 8); dynstr_append_checked(&insert_pat, " VALUES ");
if (!extended_insert) if (!extended_insert)
dynstr_append_mem(&insert_pat, "(", 1); dynstr_append_checked(&insert_pat, "(");
} }
} }
...@@ -1753,10 +1808,10 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1753,10 +1808,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{ {
if (init) if (init)
{ {
dynstr_append_mem(&insert_pat, ", ", 2); dynstr_append_checked(&insert_pat, ", ");
} }
init=1; init=1;
dynstr_append(&insert_pat, dynstr_append_checked(&insert_pat,
quote_name(row[SHOW_FIELDNAME], name_buff, 0)); quote_name(row[SHOW_FIELDNAME], name_buff, 0));
} }
} }
...@@ -1771,10 +1826,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1771,10 +1826,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_snprintf(query_buff, sizeof(query_buff), "show fields from %s", my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
result_table); result_table);
if (mysql_query_with_error_report(mysql, &result, query_buff)) if (mysql_query_with_error_report(mysql, &result, query_buff))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
/* Make an sql-file, if path was given iow. option -T was given */ /* Make an sql-file, if path was given iow. option -T was given */
if (!opt_no_create_info) if (!opt_no_create_info)
...@@ -1782,10 +1834,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1782,10 +1834,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (path) if (path)
{ {
if (!(sql_file= open_sql_file_for_table(table))) if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
write_header(sql_file, db); write_header(sql_file, db);
} }
if (!opt_xml && opt_comments) if (!opt_xml && opt_comments)
...@@ -1803,17 +1852,17 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1803,17 +1852,17 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (write_data) if (write_data)
{ {
dynstr_append_mem(&insert_pat, "INSERT ", 7); dynstr_append_checked(&insert_pat, "INSERT ");
dynstr_append(&insert_pat, insert_option); dynstr_append_checked(&insert_pat, insert_option);
dynstr_append_mem(&insert_pat, "INTO ", 5); dynstr_append_checked(&insert_pat, "INTO ");
dynstr_append(&insert_pat, result_table); dynstr_append_checked(&insert_pat, result_table);
if (opt_complete_insert) if (opt_complete_insert)
dynstr_append_mem(&insert_pat, " (", 2); dynstr_append_checked(&insert_pat, " (");
else else
{ {
dynstr_append_mem(&insert_pat, " VALUES ", 8); dynstr_append_checked(&insert_pat, " VALUES ");
if (!extended_insert) if (!extended_insert)
dynstr_append_mem(&insert_pat, "(", 1); dynstr_append_checked(&insert_pat, "(");
} }
} }
...@@ -1828,11 +1877,11 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1828,11 +1877,11 @@ static uint get_table_structure(char *table, char *db, char *table_type,
check_io(sql_file); check_io(sql_file);
} }
if (complete_insert) if (complete_insert)
dynstr_append_mem(&insert_pat, ", ", 2); dynstr_append_checked(&insert_pat, ", ");
} }
init=1; init=1;
if (opt_complete_insert) if (opt_complete_insert)
dynstr_append(&insert_pat, dynstr_append_checked(&insert_pat,
quote_name(row[SHOW_FIELDNAME], name_buff, 0)); quote_name(row[SHOW_FIELDNAME], name_buff, 0));
if (!opt_no_create_info) if (!opt_no_create_info)
{ {
...@@ -1882,7 +1931,6 @@ static uint get_table_structure(char *table, char *db, char *table_type, ...@@ -1882,7 +1931,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_progname, result_table, mysql_error(mysql)); my_progname, result_table, mysql_error(mysql));
if (path) if (path)
my_fclose(sql_file, MYF(MY_WME)); my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1992,9 +2040,9 @@ continue_xml: ...@@ -1992,9 +2040,9 @@ continue_xml:
} }
if (opt_complete_insert) if (opt_complete_insert)
{ {
dynstr_append_mem(&insert_pat, ") VALUES ", 9); dynstr_append_checked(&insert_pat, ") VALUES ");
if (!extended_insert) if (!extended_insert)
dynstr_append_mem(&insert_pat, "(", 1); dynstr_append_checked(&insert_pat, "(");
} }
if (sql_file != md_result_file) if (sql_file != md_result_file)
{ {
...@@ -2041,7 +2089,6 @@ static void dump_triggers_for_table(char *table, ...@@ -2041,7 +2089,6 @@ static void dump_triggers_for_table(char *table,
{ {
if (path) if (path)
my_fclose(sql_file, MYF(MY_WME)); my_fclose(sql_file, MYF(MY_WME));
safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
if (mysql_num_rows(result)) if (mysql_num_rows(result))
...@@ -2100,24 +2147,28 @@ DELIMITER ;;\n"); ...@@ -2100,24 +2147,28 @@ DELIMITER ;;\n");
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
static char *add_load_option(char *ptr,const char *object, static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *statement) const char *option_value)
{ {
if (object) if (!option_value)
{ {
/* Don't escape hex constants */ /* Null value means we don't add this option. */
if (object[0] == '0' && (object[1] == 'x' || object[1] == 'X')) return;
ptr= strxmov(ptr," ",statement," ",object,NullS); }
else
{ dynstr_append_checked(str, option);
/* char constant; escape */
ptr= strxmov(ptr," ",statement," '",NullS); if (strncmp(option_value, "0x", sizeof("0x")-1) == 0)
ptr= field_escape(ptr,object,(uint) strlen(object)); {
*ptr++= '\''; /* It's a hex constant, don't escape */
} dynstr_append_checked(str, option_value);
} }
return ptr; else
} /* add_load_option */ {
/* char constant; escape */
field_escape(str, option_value);
}
}
/* /*
...@@ -2127,28 +2178,36 @@ static char *add_load_option(char *ptr,const char *object, ...@@ -2127,28 +2178,36 @@ static char *add_load_option(char *ptr,const char *object,
syntax errors from the SQL parser. syntax errors from the SQL parser.
*/ */
static char *field_escape(char *to,const char *from,uint length) static void field_escape(DYNAMIC_STRING* in, const char *from)
{ {
const char *end; uint end_backslashes= 0;
uint end_backslashes=0;
for (end= from+length; from != end; from++) dynstr_append_checked(in, "'");
while (*from)
{ {
*to++= *from; dynstr_append_mem_checked(in, from, 1);
if (*from == '\\') if (*from == '\\')
end_backslashes^=1; /* find odd number of backslashes */ end_backslashes^=1; /* find odd number of backslashes */
else else
{ {
if (*from == '\'' && !end_backslashes) if (*from == '\'' && !end_backslashes)
*to++= *from; /* We want a duplicate of "'" for MySQL */ {
/* We want a duplicate of "'" for MySQL */
dynstr_append_checked(in, "\'");
}
end_backslashes=0; end_backslashes=0;
} }
from++;
} }
/* Add missing backslashes if user has specified odd number of backs.*/ /* Add missing backslashes if user has specified odd number of backs.*/
if (end_backslashes) if (end_backslashes)
*to++= '\\'; dynstr_append_checked(in, "\\");
return to;
} /* field_escape */ dynstr_append_checked(in, "'");
}
static char *alloc_query_str(ulong size) static char *alloc_query_str(ulong size)
...@@ -2156,10 +2215,8 @@ static char *alloc_query_str(ulong size) ...@@ -2156,10 +2215,8 @@ static char *alloc_query_str(ulong size)
char *query; char *query;
if (!(query= (char*) my_malloc(size, MYF(MY_WME)))) if (!(query= (char*) my_malloc(size, MYF(MY_WME))))
{ die(EX_MYSQLERR, "Couldn't allocate a query string.");
ignore_errors= 0; /* Fatal error */
safe_exit(EX_MYSQLERR); /* Force exit */
}
return query; return query;
} }
...@@ -2179,13 +2236,14 @@ static char *alloc_query_str(ulong size) ...@@ -2179,13 +2236,14 @@ static char *alloc_query_str(ulong size)
void void
*/ */
static void dump_table(char *table, char *db) static void dump_table(char *table, char *db)
{ {
char ignore_flag; char ignore_flag;
char query_buf[QUERY_LENGTH], *end, buff[256],table_buff[NAME_LEN+3]; char buf[200], table_buff[NAME_LEN+3];
DYNAMIC_STRING query_string;
char table_type[NAME_LEN]; char table_type[NAME_LEN];
char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table; char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table;
char *query= query_buf;
int error= 0; int error= 0;
ulong rownr, row_break, total_length, init_length; ulong rownr, row_break, total_length, init_length;
uint num_fields; uint num_fields;
...@@ -2239,44 +2297,69 @@ static void dump_table(char *table, char *db) ...@@ -2239,44 +2297,69 @@ static void dump_table(char *table, char *db)
opt_quoted_table= quote_name(table, table_buff2, 0); opt_quoted_table= quote_name(table, table_buff2, 0);
verbose_msg("-- Sending SELECT query...\n"); verbose_msg("-- Sending SELECT query...\n");
init_dynamic_string_checked(&query_string, "", 1024, 1024);
if (path) if (path)
{ {
char filename[FN_REFLEN], tmp_path[FN_REFLEN]; char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
if (strlen(path) >= FN_REFLEN)
{
/*
This check is made because the some the file functions below
have FN_REFLEN sized stack allocated buffers and will cause
a crash even if the input destination buffer is large enough
to hold the output.
*/
die(EX_USAGE, "Input filename or options too long: %s", path);
}
/*
Convert the path to native os format
and resolve to the full filepath.
*/
convert_dirname(tmp_path,path,NullS);
my_load_path(tmp_path, tmp_path, NULL); my_load_path(tmp_path, tmp_path, NULL);
fn_format(filename, table, tmp_path, ".txt", 4); fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME));
my_delete(filename, MYF(0)); /* 'INTO OUTFILE' doesn't work, if
filename wasn't deleted */ /* Must delete the file that 'INTO OUTFILE' will write to */
my_delete(filename, MYF(0));
/* convert to a unix path name to stick into the query */
to_unix_path(filename); to_unix_path(filename);
my_snprintf(query, QUERY_LENGTH,
"SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '%s'", /* now build the query string */
filename);
end= strend(query); dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '");
dynstr_append_checked(&query_string, filename);
dynstr_append_checked(&query_string, "'");
if (fields_terminated || enclosed || opt_enclosed || escaped) if (fields_terminated || enclosed || opt_enclosed || escaped)
end= strmov(end, " FIELDS"); dynstr_append_checked(&query_string, " FIELDS");
end= add_load_option(end, fields_terminated, " TERMINATED BY");
end= add_load_option(end, enclosed, " ENCLOSED BY"); add_load_option(&query_string, " TERMINATED BY ", fields_terminated);
end= add_load_option(end, opt_enclosed, " OPTIONALLY ENCLOSED BY"); add_load_option(&query_string, " ENCLOSED BY ", enclosed);
end= add_load_option(end, escaped, " ESCAPED BY"); add_load_option(&query_string, " OPTIONALLY ENCLOSED BY ", opt_enclosed);
end= add_load_option(end, lines_terminated, " LINES TERMINATED BY"); add_load_option(&query_string, " ESCAPED BY ", escaped);
*end= '\0'; add_load_option(&query_string, " LINES TERMINATED BY ", lines_terminated);
my_snprintf(buff, sizeof(buff), " FROM %s", result_table); dynstr_append_checked(&query_string, " FROM ");
end= strmov(end,buff); dynstr_append_checked(&query_string, result_table);
if (where || order_by)
{ if (where)
query= alloc_query_str((ulong) ((end - query) + 1 + {
(where ? strlen(where) + 7 : 0) + dynstr_append_checked(&query_string, " WHERE ");
(order_by ? strlen(order_by) + 10 : 0))); dynstr_append_checked(&query_string, where);
end= strmov(query, query_buf); }
if (where) if (order_by)
end= strxmov(end, " WHERE ", where, NullS); {
if (order_by) dynstr_append_checked(&query_string, " ORDER BY ");
end= strxmov(end, " ORDER BY ", order_by, NullS); dynstr_append_checked(&query_string, order_by);
} }
if (mysql_real_query(mysql, query, (uint) (end - query)))
if (mysql_real_query(mysql, query_string.str, query_string.length))
{ {
DB_error(mysql, "when executing 'SELECT INTO OUTFILE'"); DB_error(mysql, "when executing 'SELECT INTO OUTFILE'");
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -2290,41 +2373,38 @@ static void dump_table(char *table, char *db) ...@@ -2290,41 +2373,38 @@ static void dump_table(char *table, char *db)
result_table); result_table);
check_io(md_result_file); check_io(md_result_file);
} }
my_snprintf(query, QUERY_LENGTH,
"SELECT /*!40001 SQL_NO_CACHE */ * FROM %s", dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM ");
result_table); dynstr_append_checked(&query_string, result_table);
if (where || order_by)
{
query= alloc_query_str((ulong) (strlen(query) + 1 +
(where ? strlen(where) + 7 : 0) +
(order_by ? strlen(order_by) + 10 : 0)));
end= strmov(query, query_buf);
if (where) if (where)
{
if (!opt_xml && opt_comments)
{ {
if (!opt_xml && opt_comments) fprintf(md_result_file, "-- WHERE: %s\n", where);
{ check_io(md_result_file);
fprintf(md_result_file, "-- WHERE: %s\n", where);
check_io(md_result_file);
}
end= strxmov(end, " WHERE ", where, NullS);
} }
if (order_by)
dynstr_append_checked(&query_string, " WHERE ");
dynstr_append_checked(&query_string, where);
}
if (order_by)
{
if (!opt_xml && opt_comments)
{ {
if (!opt_xml && opt_comments) fprintf(md_result_file, "-- ORDER BY: %s\n", order_by);
{ check_io(md_result_file);
fprintf(md_result_file, "-- ORDER BY: %s\n", order_by);
check_io(md_result_file);
}
end= strxmov(end, " ORDER BY ", order_by, NullS);
} }
dynstr_append_checked(&query_string, " ORDER BY ");
dynstr_append_checked(&query_string, order_by);
} }
if (!opt_xml && !opt_compact) if (!opt_xml && !opt_compact)
{ {
fputs("\n", md_result_file); fputs("\n", md_result_file);
check_io(md_result_file); check_io(md_result_file);
} }
if (mysql_query_with_error_report(mysql, 0, query)) if (mysql_query_with_error_report(mysql, 0, query_string.str))
{ {
DB_error(mysql, "when retrieving data from server"); DB_error(mysql, "when retrieving data from server");
goto err; goto err;
...@@ -2398,14 +2478,9 @@ static void dump_table(char *table, char *db) ...@@ -2398,14 +2478,9 @@ static void dump_table(char *table, char *db)
ulong length= lengths[i]; ulong length= lengths[i];
if (!(field= mysql_fetch_field(res))) if (!(field= mysql_fetch_field(res)))
{ die(EX_CONSCHECK,
my_snprintf(query, QUERY_LENGTH, "Not enough fields from table %s! Aborting.\n",
"%s: Not enough fields from table %s! Aborting.\n", result_table);
my_progname, result_table);
fputs(query,stderr);
error= EX_CONSCHECK;
goto err;
}
/* /*
63 is my_charset_bin. If charsetnr is not 63, 63 is my_charset_bin. If charsetnr is not 63,
...@@ -2424,9 +2499,9 @@ static void dump_table(char *table, char *db) ...@@ -2424,9 +2499,9 @@ static void dump_table(char *table, char *db)
if (extended_insert && !opt_xml) if (extended_insert && !opt_xml)
{ {
if (i == 0) if (i == 0)
dynstr_set(&extended_row,"("); dynstr_set_checked(&extended_row,"(");
else else
dynstr_append(&extended_row,","); dynstr_append_checked(&extended_row,",");
if (row[i]) if (row[i])
{ {
...@@ -2441,15 +2516,10 @@ static void dump_table(char *table, char *db) ...@@ -2441,15 +2516,10 @@ static void dump_table(char *table, char *db)
- In non-HEX mode we need up to 2 bytes per character, - In non-HEX mode we need up to 2 bytes per character,
plus 2 bytes for leading and trailing '\'' characters. plus 2 bytes for leading and trailing '\'' characters.
*/ */
if (dynstr_realloc(&extended_row,length * 2+2)) dynstr_realloc_checked(&extended_row,length * 2+2);
{
fputs("Aborting dump (out of memory)",stderr);
error= EX_EOM;
goto err;
}
if (opt_hex_blob && is_blob) if (opt_hex_blob && is_blob)
{ {
dynstr_append(&extended_row, "0x"); dynstr_append_checked(&extended_row, "0x");
extended_row.length+= mysql_hex_string(extended_row.str + extended_row.length+= mysql_hex_string(extended_row.str +
extended_row.length, extended_row.length,
row[i], length); row[i], length);
...@@ -2457,13 +2527,13 @@ static void dump_table(char *table, char *db) ...@@ -2457,13 +2527,13 @@ static void dump_table(char *table, char *db)
} }
else else
{ {
dynstr_append(&extended_row,"'"); dynstr_append_checked(&extended_row,"'");
extended_row.length += extended_row.length +=
mysql_real_escape_string(&mysql_connection, mysql_real_escape_string(&mysql_connection,
&extended_row.str[extended_row.length], &extended_row.str[extended_row.length],
row[i],length); row[i],length);
extended_row.str[extended_row.length]='\0'; extended_row.str[extended_row.length]='\0';
dynstr_append(&extended_row,"'"); dynstr_append_checked(&extended_row,"'");
} }
} }
else else
...@@ -2472,30 +2542,26 @@ static void dump_table(char *table, char *db) ...@@ -2472,30 +2542,26 @@ static void dump_table(char *table, char *db)
char *ptr= row[i]; char *ptr= row[i];
if (my_isalpha(charset_info, *ptr) || (*ptr == '-' && if (my_isalpha(charset_info, *ptr) || (*ptr == '-' &&
my_isalpha(charset_info, ptr[1]))) my_isalpha(charset_info, ptr[1])))
dynstr_append(&extended_row, "NULL"); dynstr_append_checked(&extended_row, "NULL");
else else
{ {
if (field->type == FIELD_TYPE_DECIMAL) if (field->type == FIELD_TYPE_DECIMAL)
{ {
/* add " signs around */ /* add " signs around */
dynstr_append(&extended_row, "'"); dynstr_append_checked(&extended_row, "'");
dynstr_append(&extended_row, ptr); dynstr_append_checked(&extended_row, ptr);
dynstr_append(&extended_row, "'"); dynstr_append_checked(&extended_row, "'");
} }
else else
dynstr_append(&extended_row, ptr); dynstr_append_checked(&extended_row, ptr);
} }
} }
} }
else else
dynstr_append(&extended_row,"''"); dynstr_append_checked(&extended_row,"''");
}
else if (dynstr_append(&extended_row,"NULL"))
{
fputs("Aborting dump (out of memory)",stderr);
error= EX_EOM;
goto err;
} }
else
dynstr_append_checked(&extended_row,"NULL");
} }
else else
{ {
...@@ -2512,16 +2578,16 @@ static void dump_table(char *table, char *db) ...@@ -2512,16 +2578,16 @@ static void dump_table(char *table, char *db)
{ {
if (opt_hex_blob && is_blob && length) if (opt_hex_blob && is_blob && length)
{ {
/* Define xsi:type="xs:hexBinary" for hex encoded data */ /* Define xsi:type="xs:hexBinary" for hex encoded data */
print_xml_tag(md_result_file, "\t\t", "", "field", "name=", print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
field->name, "xsi:type=", "xs:hexBinary", NullS); field->name, "xsi:type=", "xs:hexBinary", NullS);
print_blob_as_hex(md_result_file, row[i], length); print_blob_as_hex(md_result_file, row[i], length);
} }
else else
{ {
print_xml_tag(md_result_file, "\t\t", "", "field", "name=", print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
field->name, NullS); field->name, NullS);
print_quoted_xml(md_result_file, row[i], length); print_quoted_xml(md_result_file, row[i], length);
} }
fputs("</field>\n", md_result_file); fputs("</field>\n", md_result_file);
} }
...@@ -2581,7 +2647,7 @@ static void dump_table(char *table, char *db) ...@@ -2581,7 +2647,7 @@ static void dump_table(char *table, char *db)
if (extended_insert) if (extended_insert)
{ {
ulong row_length; ulong row_length;
dynstr_append(&extended_row,")"); dynstr_append_checked(&extended_row,")");
row_length= 2 + extended_row.length; row_length= 2 + extended_row.length;
if (total_length + row_length < opt_net_buffer_length) if (total_length + row_length < opt_net_buffer_length)
{ {
...@@ -2617,14 +2683,14 @@ static void dump_table(char *table, char *db) ...@@ -2617,14 +2683,14 @@ static void dump_table(char *table, char *db)
check_io(md_result_file); check_io(md_result_file);
if (mysql_errno(mysql)) if (mysql_errno(mysql))
{ {
my_snprintf(query, QUERY_LENGTH, my_snprintf(buf, sizeof(buf),
"%s: Error %d: %s when dumping table %s at row: %ld\n", "%s: Error %d: %s when dumping table %s at row: %ld\n",
my_progname, my_progname,
mysql_errno(mysql), mysql_errno(mysql),
mysql_error(mysql), mysql_error(mysql),
result_table, result_table,
rownr); rownr);
fputs(query,stderr); fputs(buf,stderr);
error= EX_CONSCHECK; error= EX_CONSCHECK;
goto err; goto err;
} }
...@@ -2647,15 +2713,13 @@ static void dump_table(char *table, char *db) ...@@ -2647,15 +2713,13 @@ static void dump_table(char *table, char *db)
check_io(md_result_file); check_io(md_result_file);
} }
mysql_free_result(res); mysql_free_result(res);
if (query != query_buf) dynstr_free(&query_string);
my_free(query, MYF(MY_ALLOW_ZERO_PTR));
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
err: err:
if (query != query_buf) dynstr_free(&query_string);
my_free(query, MYF(MY_ALLOW_ZERO_PTR)); maybe_exit(error);
safe_exit(error);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} /* dump_table */ } /* dump_table */
...@@ -2842,8 +2906,8 @@ static int init_dumping(char *database, int init_func(char*)) ...@@ -2842,8 +2906,8 @@ static int init_dumping(char *database, int init_func(char*))
check_io(md_result_file); check_io(md_result_file);
} }
} }
if (extended_insert && init_dynamic_string(&extended_row, "", 1024, 1024)) if (extended_insert)
exit(EX_EOM); init_dynamic_string_checked(&extended_row, "", 1024, 1024);
return 0; return 0;
} /* init_dumping */ } /* init_dumping */
...@@ -2876,11 +2940,11 @@ static int dump_all_tables_in_db(char *database) ...@@ -2876,11 +2940,11 @@ static int dump_all_tables_in_db(char *database)
if (lock_tables) if (lock_tables)
{ {
DYNAMIC_STRING query; DYNAMIC_STRING query;
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024); init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
for (numrows= 0 ; (table= getTableName(1)) ; numrows++) for (numrows= 0 ; (table= getTableName(1)) ; numrows++)
{ {
dynstr_append(&query, quote_name(table, table_buff, 1)); dynstr_append_checked(&query, quote_name(table, table_buff, 1));
dynstr_append(&query, " READ /*!32311 LOCAL */,"); dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
} }
if (numrows && mysql_real_query(mysql, query.str, query.length-1)) if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES"); DB_error(mysql, "when using LOCK TABLES");
...@@ -2953,11 +3017,11 @@ static my_bool dump_all_views_in_db(char *database) ...@@ -2953,11 +3017,11 @@ static my_bool dump_all_views_in_db(char *database)
if (lock_tables) if (lock_tables)
{ {
DYNAMIC_STRING query; DYNAMIC_STRING query;
init_dynamic_string(&query, "LOCK TABLES ", 256, 1024); init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
for (numrows= 0 ; (table= getTableName(1)); numrows++) for (numrows= 0 ; (table= getTableName(1)); numrows++)
{ {
dynstr_append(&query, quote_name(table, table_buff, 1)); dynstr_append_checked(&query, quote_name(table, table_buff, 1));
dynstr_append(&query, " READ /*!32311 LOCAL */,"); dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
} }
if (numrows && mysql_real_query(mysql, query.str, query.length-1)) if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES"); DB_error(mysql, "when using LOCK TABLES");
...@@ -3009,9 +3073,7 @@ static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root) ...@@ -3009,9 +3073,7 @@ static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root)
quote_for_like(old_table_name, show_name_buff)); quote_for_like(old_table_name, show_name_buff));
if (mysql_query_with_error_report(mysql, 0, query)) if (mysql_query_with_error_report(mysql, 0, query))
{ return NullS;
safe_exit(EX_MYSQLERR);
}
if ((table_res= mysql_store_result(mysql))) if ((table_res= mysql_store_result(mysql)))
{ {
...@@ -3047,9 +3109,9 @@ static int dump_selected_tables(char *db, char **table_names, int tables) ...@@ -3047,9 +3109,9 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
init_alloc_root(&root, 8192, 0); init_alloc_root(&root, 8192, 0);
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *)))) if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *))))
exit(EX_EOM); die(EX_EOM, "alloc_root failure.");
init_dynamic_string(&lock_tables_query, "LOCK TABLES ", 256, 1024); init_dynamic_string_checked(&lock_tables_query, "LOCK TABLES ", 256, 1024);
for (; tables > 0 ; tables-- , table_names++) for (; tables > 0 ; tables-- , table_names++)
{ {
/* the table name passed on commandline may be wrong case */ /* the table name passed on commandline may be wrong case */
...@@ -3058,16 +3120,14 @@ static int dump_selected_tables(char *db, char **table_names, int tables) ...@@ -3058,16 +3120,14 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
/* Add found table name to lock_tables_query */ /* Add found table name to lock_tables_query */
if (lock_tables) if (lock_tables)
{ {
dynstr_append(&lock_tables_query, quote_name(*pos, table_buff, 1)); dynstr_append_checked(&lock_tables_query, quote_name(*pos, table_buff, 1));
dynstr_append(&lock_tables_query, " READ /*!32311 LOCAL */,"); dynstr_append_checked(&lock_tables_query, " READ /*!32311 LOCAL */,");
} }
pos++; pos++;
} }
else else
{ {
my_printf_error(0,"Couldn't find table: \"%s\"\n", MYF(0), maybe_die(EX_ILLEGAL_TABLE, "Couldn't find table: \"%s\"", *table_names);
*table_names);
safe_exit(EX_ILLEGAL_TABLE);
/* We shall countinue here, if --force was given */ /* We shall countinue here, if --force was given */
} }
} }
...@@ -3482,12 +3542,12 @@ static int replace(DYNAMIC_STRING *ds_str, ...@@ -3482,12 +3542,12 @@ static int replace(DYNAMIC_STRING *ds_str,
const char *start= strstr(ds_str->str, search_str); const char *start= strstr(ds_str->str, search_str);
if (!start) if (!start)
return 1; return 1;
init_dynamic_string(&ds_tmp, "", init_dynamic_string_checked(&ds_tmp, "",
ds_str->length + replace_len, 256); ds_str->length + replace_len, 256);
dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str); dynstr_append_mem_checked(&ds_tmp, ds_str->str, start - ds_str->str);
dynstr_append_mem(&ds_tmp, replace_str, replace_len); dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len);
dynstr_append(&ds_tmp, start + search_len); dynstr_append_checked(&ds_tmp, start + search_len);
dynstr_set(ds_str, ds_tmp.str); dynstr_set_checked(ds_str, ds_tmp.str);
dynstr_free(&ds_tmp); dynstr_free(&ds_tmp);
return 0; return 0;
} }
...@@ -3533,10 +3593,7 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -3533,10 +3593,7 @@ static my_bool get_view_structure(char *table, char* db)
my_snprintf(query, sizeof(query), "SHOW CREATE TABLE %s", result_table); my_snprintf(query, sizeof(query), "SHOW CREATE TABLE %s", result_table);
if (mysql_query_with_error_report(mysql, &table_res, query)) if (mysql_query_with_error_report(mysql, &table_res, query))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0); DBUG_RETURN(0);
}
/* Check if this is a view */ /* Check if this is a view */
field= mysql_fetch_field_direct(table_res, 0); field= mysql_fetch_field_direct(table_res, 0);
...@@ -3550,10 +3607,8 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -3550,10 +3607,8 @@ static my_bool get_view_structure(char *table, char* db)
if (path) if (path)
{ {
if (!(sql_file= open_sql_file_for_table(table))) if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1); DBUG_RETURN(1);
}
write_header(sql_file, db); write_header(sql_file, db);
} }
...@@ -3599,14 +3654,14 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -3599,14 +3654,14 @@ static my_bool get_view_structure(char *table, char* db)
/* Save the result of SHOW CREATE TABLE in ds_view */ /* Save the result of SHOW CREATE TABLE in ds_view */
row= mysql_fetch_row(table_res); row= mysql_fetch_row(table_res);
lengths= mysql_fetch_lengths(table_res); lengths= mysql_fetch_lengths(table_res);
init_dynamic_string(&ds_view, row[1], lengths[1] + 1, 1024); init_dynamic_string_checked(&ds_view, row[1], lengths[1] + 1, 1024);
mysql_free_result(table_res); mysql_free_result(table_res);
/* Get the result from "select ... information_schema" */ /* Get the result from "select ... information_schema" */
if (!(table_res= mysql_store_result(mysql)) || if (!(table_res= mysql_store_result(mysql)) ||
!(row= mysql_fetch_row(table_res))) !(row= mysql_fetch_row(table_res)))
{ {
safe_exit(EX_MYSQLERR); DB_error(mysql, "when trying to save the result of SHOW CREATE TABLE in ds_view.");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -3678,6 +3733,45 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -3678,6 +3733,45 @@ static my_bool get_view_structure(char *table, char* db)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/*
The following functions are wrappers for the dynamic string functions
and if they fail, the wrappers will terminate the current process.
*/
#define DYNAMIC_STR_ERROR_MSG "Couldn't perform DYNAMIC_STRING operation"
static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
uint init_alloc, uint alloc_increment)
{
if (init_dynamic_string(str, init_str, init_alloc, alloc_increment))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
static void dynstr_append_checked(DYNAMIC_STRING* dest, const char* src)
{
if (dynstr_append(dest, src))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
static void dynstr_set_checked(DYNAMIC_STRING *str, const char *init_str)
{
if (dynstr_set(str, init_str))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
static void dynstr_append_mem_checked(DYNAMIC_STRING *str, const char *append,
uint length)
{
if (dynstr_append_mem(str, append, length))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size)
{
if (dynstr_realloc(str, additional_size))
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
......
...@@ -1567,29 +1567,17 @@ create table t3(a varchar(30) primary key, b int not null); ...@@ -1567,29 +1567,17 @@ create table t3(a varchar(30) primary key, b int not null);
test_sequence test_sequence
------ Testing with illegal table names ------ ------ Testing with illegal table names ------
mysqldump: Couldn't find table: "\d-2-1.sql" mysqldump: Couldn't find table: "\d-2-1.sql"
mysqldump: Couldn't find table: "\t1" mysqldump: Couldn't find table: "\t1"
mysqldump: Couldn't find table: "\t1" mysqldump: Couldn't find table: "\t1"
mysqldump: Couldn't find table: "\\t1" mysqldump: Couldn't find table: "\\t1"
mysqldump: Couldn't find table: "t\1" mysqldump: Couldn't find table: "t\1"
mysqldump: Couldn't find table: "t\1" mysqldump: Couldn't find table: "t\1"
mysqldump: Couldn't find table: "t/1" mysqldump: Couldn't find table: "t/1"
mysqldump: Couldn't find table: "T_1" mysqldump: Couldn't find table: "T_1"
mysqldump: Couldn't find table: "T%1" mysqldump: Couldn't find table: "T%1"
mysqldump: Couldn't find table: "T'1" mysqldump: Couldn't find table: "T'1"
mysqldump: Couldn't find table: "T_1" mysqldump: Couldn't find table: "T_1"
mysqldump: Couldn't find table: "T_" mysqldump: Couldn't find table: "T_"
test_sequence test_sequence
------ Testing with illegal database names ------ ------ Testing with illegal database names ------
mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database
...@@ -3218,5 +3206,12 @@ INSERT INTO t1 VALUES(1,0xff00fef0); ...@@ -3218,5 +3206,12 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
</mysqldump> </mysqldump>
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#26346: stack + buffer overrun in mysqldump
#
CREATE TABLE t1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0 tests # End of 5.0 tests
# #
...@@ -1429,6 +1429,30 @@ INSERT INTO t1 VALUES(1,0xff00fef0); ...@@ -1429,6 +1429,30 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#26346: stack + buffer overrun in mysqldump
--echo #
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
# too long a file path causes an error
--error 1
--exec $MYSQL_DUMP --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
DROP TABLE t1;
--echo # --echo #
--echo # End of 5.0 tests --echo # End of 5.0 tests
--echo # --echo #
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment