summaryrefslogtreecommitdiff
path: root/client/sql_string.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-09-20 17:17:32 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-09-20 17:17:32 +0300
commit353739fdef95fb1765dbbadf14ce1a9849a36137 (patch)
tree4b2b7364d1e622b3b02db3fb9d0c898fb9293a87 /client/sql_string.cc
parent9fee5866beed47b55c5196acfa1a03503a13a2d7 (diff)
parentf4444c0016c68feb3f300c4b30b886cd407f5824 (diff)
downloadmariadb-git-353739fdef95fb1765dbbadf14ce1a9849a36137.tar.gz
merge of mysql-5.5 into mysql-5.5-wl1054
Diffstat (limited to 'client/sql_string.cc')
-rw-r--r--client/sql_string.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/sql_string.cc b/client/sql_string.cc
index 6b749409a64..dec6ac94eb2 100644
--- a/client/sql_string.cc
+++ b/client/sql_string.cc
@@ -31,9 +31,12 @@
** String functions
*****************************************************************************/
-bool String::real_alloc(uint32 arg_length)
+bool String::real_alloc(uint32 length)
{
- arg_length=ALIGN_SIZE(arg_length+1);
+ uint32 arg_length= ALIGN_SIZE(length + 1);
+ DBUG_ASSERT(arg_length > length);
+ if (arg_length <= length)
+ return TRUE; /* Overflow */
str_length=0;
if (Alloced_length < arg_length)
{
@@ -56,6 +59,9 @@ bool String::real_alloc(uint32 arg_length)
bool String::realloc(uint32 alloc_length)
{
uint32 len=ALIGN_SIZE(alloc_length+1);
+ DBUG_ASSERT(len > alloc_length);
+ if (len <= alloc_length)
+ return TRUE; /* Overflow */
if (Alloced_length < len)
{
char *new_ptr;