commit 39b6c2e1c5b8a0dea9c9c1df0f9bab8e71b1353b parent 1bc35ab9741ab65104ae15cbed0f7587b549d09c Author: Christian Grothoff <christian@grothoff.org> Date: Fri, 14 Jan 2011 18:21:17 +0000 nullcheck Diffstat:
| M | src/daemon/base64.c | | | 5 | +++-- |
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/daemon/base64.c b/src/daemon/base64.c @@ -68,8 +68,9 @@ char* BASE64Decode(const char* src) { /* Wrong base64 string length */ return NULL; } - result = dest = (char*) malloc(in_len / 4 * 3 + 1); - + result = dest = malloc(in_len / 4 * 3 + 1); + if (result == NULL) + return NULL; /* out of memory */ while (*src) { char a = base64_digits[(unsigned char)*(src++)]; char b = base64_digits[(unsigned char)*(src++)];