diff options
author | Georgi Kodinov <joro@sun.com> | 2009-04-17 19:18:00 +0300 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2009-04-17 19:18:00 +0300 |
commit | 4cd9f6e1ae321ddc90a5aa714c21272780a45dd1 (patch) | |
tree | 693db566fa15581a6e69948b79e1fecc4730dd39 /sql/item_strfunc.cc | |
parent | 65e3d360f9daa12bd882288dd82ccdb02b05b613 (diff) | |
parent | 4783b2e196e4ed4c037194d74b99922e92deecd0 (diff) | |
download | mariadb-git-4cd9f6e1ae321ddc90a5aa714c21272780a45dd1.tar.gz |
merged bug 35087 to 5.1-bugteam
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 649910e1162..5a8b1c6493c 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -504,17 +504,21 @@ String *Item_func_des_encrypt::val_str(String *str) string marking change of string length. */ - tail= (8-(res_length) % 8); // 1..8 marking extra length + tail= 8 - (res_length % 8); // 1..8 marking extra length res_length+=tail; + tmp_arg.realloc(res_length); + tmp_arg.length(0); + tmp_arg.append(res->ptr(), res->length()); code= ER_OUT_OF_RESOURCES; - if (tail && res->append(append_str, tail) || tmp_value.alloc(res_length+1)) + if (tmp_arg.append(append_str, tail) || tmp_value.alloc(res_length+1)) goto error; - (*res)[res_length-1]=tail; // save extra length + tmp_arg[res_length-1]=tail; // save extra length + tmp_value.realloc(res_length+1); tmp_value.length(res_length+1); tmp_value[0]=(char) (128 | key_number); // Real encryption bzero((char*) &ivec,sizeof(ivec)); - DES_ede3_cbc_encrypt((const uchar*) (res->ptr()), + DES_ede3_cbc_encrypt((const uchar*) (tmp_arg.ptr()), (uchar*) (tmp_value.ptr()+1), res_length, &keyschedule.ks1, |