summaryrefslogtreecommitdiff
path: root/sql/sql_error.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_error.cc')
-rw-r--r--sql/sql_error.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 7988523dd3b..06da6250e71 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -806,14 +806,16 @@ uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs,
my_wc_t wc;
const uchar *from_end= (const uchar*) from+from_length;
char *to_start= to;
- uchar *to_end= (uchar*) to+to_length;
+ uchar *to_end;
my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
my_charset_conv_wc_mb wc_mb;
uint error_count= 0;
uint length;
DBUG_ASSERT(to_length > 0);
+ /* Make room for the null terminator. */
to_length--;
+ to_end= (uchar*) (to + to_length);
if (!to_cs || from_cs == to_cs || to_cs == &my_charset_bin)
{