diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 5 | ||||
-rw-r--r-- | client/sql_string.h | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index a957f804537..07fb67093ee 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1525,6 +1525,9 @@ static int com_server_help(String *buffer __attribute__((unused)), char last_char; int num_name, num_cat; + LINT_INIT(num_name); + LINT_INIT(num_cat); + if (num_fields == 2) { put_info("Many help items for your request exist", INFO_INFO); @@ -1841,7 +1844,7 @@ print_table_data(MYSQL_RES *result) separator.fill(separator.length()+length+2,'-'); separator.append('+'); } - tee_puts(separator.c_ptr(), PAGER); + tee_puts(separator.c_ptr_safe(), PAGER); if (column_names) { mysql_field_seek(result,0); diff --git a/client/sql_string.h b/client/sql_string.h index 33f34a43b7f..aec40466d2b 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -92,6 +92,14 @@ public: Ptr[str_length]=0; return Ptr; } + inline char *c_ptr_safe() + { + if (Ptr && str_length < Alloced_length) + Ptr[str_length]=0; + else + (void) realloc(str_length); + return Ptr; + } void set(String &str,uint32 offset,uint32 arg_length) { |