summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorunknown <anozdrin@mysql.com>2006-01-20 15:59:22 +0300
committerunknown <anozdrin@mysql.com>2006-01-20 15:59:22 +0300
commitb688b196979b8385a7463e8dcd83afdd0af6ca69 (patch)
tree09e31d76f40a969088fd9d995a57faf7cac86ad6 /sql/field.cc
parent1fe1288417285cc6f5c95388bcc3305cfcebc0be (diff)
downloadmariadb-git-b688b196979b8385a7463e8dcd83afdd0af6ca69.tar.gz
Fix for BUG#15588: String overrun during sp-vars.test
The bug appears after implementation of WL#2984 (Make stored routine variables work according to the standard). mysql-test/r/type_varchar.result: Update result file. mysql-test/t/type_varchar.test: Add a test for BUG#15588. sql/field.cc: - use memmove() instead of memcpy() -- after implementation of WL#2984 (Make stored routine variables work according to the standard) it is possible to store in the field the value from this field. For instance, this can happen for the following statement: SET sp_var = SUBSTR(sp_var, 1, 3); sql/sp_head.cc: - Work correctly with String: - String length has to be be reset before use; - qs_append() does not allocate memory, so the memory should be reserved beforehand. sql/sql_select.cc: Polishing: should have been done in WL#2984.
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc
index df76eb729f8..0d48d4ae004 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5873,7 +5873,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
field_length/
field_charset->mbmaxlen,
&well_formed_error);
- memcpy(ptr,from,copy_length);
+ memmove(ptr, from, copy_length);
/* Append spaces if the string was shorter than the field. */
if (copy_length < field_length)
@@ -6266,7 +6266,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
field_length/
field_charset->mbmaxlen,
&well_formed_error);
- memcpy(ptr + length_bytes, from, copy_length);
+ memmove(ptr + length_bytes, from, copy_length);
if (length_bytes == 1)
*ptr= (uchar) copy_length;
else