summaryrefslogtreecommitdiff
path: root/mysys/base64.c
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com/june.mysql.com>2008-01-15 16:23:14 +0400
committerunknown <svoj@mysql.com/june.mysql.com>2008-01-15 16:23:14 +0400
commit082cfb87919999efe83216d572ba6c776ecf748d (patch)
treed3fe4867a53f2592716b27097fbfa933359259b1 /mysys/base64.c
parent51cb4ffcc1eb43aad9581c3f846f63b214f179ea (diff)
downloadmariadb-git-082cfb87919999efe83216d572ba6c776ecf748d.tar.gz
BUG#28884 - maybe a problem with malloc into base64.c
Fixed that return value of malloc was not checked. Fixed wrong argument count (compilation failure) to base64_decode() function. Note: - there is no test case for this fix as this code is never compiled into mysql clients/server; - as this code is used for internal testing purposes only, no changelog entry needed. mysys/base64.c: Fixed that return value of malloc was not checked. Fixed wrong argument count to base64_decode function.
Diffstat (limited to 'mysys/base64.c')
-rw-r--r--mysys/base64.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mysys/base64.c b/mysys/base64.c
index dbe8927290d..6157dcaa5af 100644
--- a/mysys/base64.c
+++ b/mysys/base64.c
@@ -256,6 +256,7 @@ main(void)
char * str;
char * dst;
+ require(src);
for (j= 0; j<src_len; j++)
{
char c= rand();
@@ -265,6 +266,7 @@ main(void)
/* Encode */
needed_length= base64_needed_encoded_length(src_len);
str= (char *) malloc(needed_length);
+ require(str);
for (k= 0; k < needed_length; k++)
str[k]= 0xff; /* Fill memory to check correct NUL termination */
require(base64_encode(src, src_len, str) == 0);
@@ -272,7 +274,8 @@ main(void)
/* Decode */
dst= (char *) malloc(base64_needed_decoded_length(strlen(str)));
- dst_len= base64_decode(str, strlen(str), dst);
+ require(dst);
+ dst_len= base64_decode(str, strlen(str), dst, NULL);
require(dst_len == src_len);
if (memcmp(src, dst, src_len) != 0)