summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-03-09 12:47:12 +0200
committerunknown <gkodinov/kgeorge@magare.gmz>2007-03-09 12:47:12 +0200
commit29b6d554028cd40459061b22d216c3b16cf6298e (patch)
treed02182747d1ea38c84935fb5b0146ce11b8103f1 /sql/item_strfunc.cc
parent1631f65dfd757282ac480fd20b3fe7b262f500c5 (diff)
downloadmariadb-git-29b6d554028cd40459061b22d216c3b16cf6298e.tar.gz
Bug #26281:
Fixed boundry checks in the INSERT() function: were one off. mysql-test/r/func_str.result: Bug #26281: test case mysql-test/t/func_str.test: Bug #26281: test case sql/item_strfunc.cc: Bug #26281: fixed boundry checks
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 385f4ad9770..8a2574bd248 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -967,18 +967,18 @@ String *Item_func_insert::val_str(String *str)
args[3]->null_value)
goto null; /* purecov: inspected */
- if ((start < 0) || (start > res->length() + 1))
+ if ((start < 0) || (start > res->length()))
return res; // Wrong param; skip insert
- if ((length < 0) || (length > res->length() + 1))
- length= res->length() + 1;
+ if ((length < 0) || (length > res->length()))
+ length= res->length();
/* start and length are now sufficiently valid to pass to charpos function */
start= res->charpos((int) start);
length= res->charpos((int) length, (uint32) start);
/* Re-testing with corrected params */
- if (start > res->length() + 1)
- return res; // Wrong param; skip insert
+ if (start > res->length())
+ return res; /* purecov: inspected */ // Wrong param; skip insert
if (length > res->length() - start)
length= res->length() - start;