Commit 0fe17677 authored by Tor Didriksen's avatar Tor Didriksen

Bug #49130 Running mtr tests with valgrind and debug produces lots of warnings

Use safe output formats for strings that are not null terminated.
parent 9f7d2458
...@@ -3127,7 +3127,7 @@ String *udf_handler::val_str(String *str,String *save_str) ...@@ -3127,7 +3127,7 @@ String *udf_handler::val_str(String *str,String *save_str)
if (res == str->ptr()) if (res == str->ptr())
{ {
str->length(res_length); str->length(res_length);
DBUG_PRINT("exit", ("str: %s", str->ptr())); DBUG_PRINT("exit", ("str: %*.s", (int) str->length(), str->ptr()));
DBUG_RETURN(str); DBUG_RETURN(str);
} }
save_str->set(res, res_length, str->charset()); save_str->set(res, res_length, str->charset());
......
...@@ -1012,8 +1012,8 @@ bool Protocol_text::store(const char *from, size_t length, ...@@ -1012,8 +1012,8 @@ bool Protocol_text::store(const char *from, size_t length,
{ {
CHARSET_INFO *tocs= this->thd->variables.character_set_results; CHARSET_INFO *tocs= this->thd->variables.character_set_results;
#ifndef DBUG_OFF #ifndef DBUG_OFF
DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %s", field_pos, DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %*.s",
field_count, from)); field_pos, field_count, (int) length, from));
DBUG_ASSERT(field_pos < field_count); DBUG_ASSERT(field_pos < field_count);
DBUG_ASSERT(field_types == 0 || DBUG_ASSERT(field_types == 0 ||
field_types[field_pos] == MYSQL_TYPE_DECIMAL || field_types[field_pos] == MYSQL_TYPE_DECIMAL ||
......
...@@ -55,19 +55,18 @@ static const char *lock_descriptions[] = ...@@ -55,19 +55,18 @@ static const char *lock_descriptions[] =
void void
print_where(COND *cond,const char *info, enum_query_type query_type) print_where(COND *cond,const char *info, enum_query_type query_type)
{ {
if (cond)
{
char buff[256]; char buff[256];
String str(buff,(uint32) sizeof(buff), system_charset_info); String str(buff,(uint32) sizeof(buff), system_charset_info);
str.length(0); str.length(0);
if (cond)
cond->print(&str, query_type); cond->print(&str, query_type);
str.append('\0'); str.append('\0');
DBUG_LOCK_FILE; DBUG_LOCK_FILE;
(void) fprintf(DBUG_FILE,"\nWHERE:(%s) ",info); (void) fprintf(DBUG_FILE,"\nWHERE:(%s) %p ", info, cond);
(void) fputs(str.ptr(),DBUG_FILE); (void) fputs(str.ptr(),DBUG_FILE);
(void) fputc('\n',DBUG_FILE); (void) fputc('\n',DBUG_FILE);
DBUG_UNLOCK_FILE; DBUG_UNLOCK_FILE;
}
} }
/* This is for debugging purposes */ /* This is for debugging purposes */
......
...@@ -819,7 +819,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, ...@@ -819,7 +819,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
thd->variables.sql_mode|= sql_mode; thd->variables.sql_mode|= sql_mode;
} }
DBUG_PRINT("info", ("View: %s", view_query.ptr())); DBUG_PRINT("info",
("View: %*.s", (int) view_query.length(), view_query.ptr()));
/* fill structure */ /* fill structure */
view->source= thd->lex->create_view_select; view->source= thd->lex->create_view_select;
......
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