summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <ram@gw.mysql.r18.ru>2004-09-13 14:25:43 +0500
committerunknown <ram@gw.mysql.r18.ru>2004-09-13 14:25:43 +0500
commitcc98eea53b3dc9258838bee9528cce9dfc771d72 (patch)
tree9ea0302aae3fbf462478c41e61d9346c0ba5f5eb /sql/item_strfunc.cc
parentc1e84276868d04c165bca8b7a5fd36fe7ff4aed5 (diff)
downloadmariadb-git-cc98eea53b3dc9258838bee9528cce9dfc771d72.tar.gz
A fix (bug #5498 TRIM fails with LEADING or TRAILING if remstr = str).
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 5d017b3a27a..9248cbc0217 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1135,7 +1135,7 @@ String *Item_func_ltrim::val_str(String *str)
{
const char *r_ptr=remove_str->ptr();
end-=remove_length;
- while (ptr < end && !memcmp(ptr,r_ptr,remove_length))
+ while (ptr <= end && !memcmp(ptr, r_ptr, remove_length))
ptr+=remove_length;
end+=remove_length;
}
@@ -1206,8 +1206,8 @@ String *Item_func_rtrim::val_str(String *str)
else
#endif /* USE_MB */
{
- while (ptr + remove_length < end &&
- !memcmp(end-remove_length,r_ptr,remove_length))
+ while (ptr + remove_length <= end &&
+ !memcmp(end-remove_length, r_ptr, remove_length))
end-=remove_length;
}
}