diff options
author | Alexey Kopytov <Alexey.Kopytov@sun.com> | 2009-02-13 19:20:56 +0300 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@sun.com> | 2009-02-13 19:20:56 +0300 |
commit | dd35a152f91cdb5790619fc3cbc0cfbc09666f5f (patch) | |
tree | e907d3bf6c88897a516896d7cc9dac08985f5907 /client/sql_string.cc | |
parent | bdbe393db1b55cbde9aa4ca66cc551b57dad7f1f (diff) | |
parent | 9373b1b88031a9bf4ef7fb1a42680c9f98f837f4 (diff) | |
download | mariadb-git-dd35a152f91cdb5790619fc3cbc0cfbc09666f5f.tar.gz |
Merge mysql-5.0-bugteam -> mysql-5.1-bugteam.
Diffstat (limited to 'client/sql_string.cc')
-rw-r--r-- | client/sql_string.cc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/client/sql_string.cc b/client/sql_string.cc index c41463999aa..82874a4b2ea 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -71,25 +71,22 @@ bool String::realloc(uint32 alloc_length) char *new_ptr; if (alloced) { - if ((new_ptr= (char*) my_realloc(Ptr,len,MYF(MY_WME)))) - { - Ptr=new_ptr; - Alloced_length=len; - } - else - return TRUE; // Signal error + if (!(new_ptr= (char*) my_realloc(Ptr,len,MYF(MY_WME)))) + return TRUE; // Signal error } else if ((new_ptr= (char*) my_malloc(len,MYF(MY_WME)))) { + if (str_length > len - 1) + str_length= 0; if (str_length) // Avoid bugs in memcpy on AIX memcpy(new_ptr,Ptr,str_length); new_ptr[str_length]=0; - Ptr=new_ptr; - Alloced_length=len; alloced=1; } else return TRUE; // Signal error + Ptr= new_ptr; + Alloced_length= len; } Ptr[alloc_length]=0; // This make other funcs shorter return FALSE; |