aboutsummaryrefslogtreecommitdiffstats
path: root/etc.c
diff options
context:
space:
mode:
Diffstat (limited to 'etc.c')
-rw-r--r--etc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/etc.c b/etc.c
index 4e662e4..bc72005 100644
--- a/etc.c
+++ b/etc.c
@@ -2013,9 +2013,13 @@ base64_encode(const unsigned char *src, size_t len)
{
unsigned char *w, *at;
const unsigned char *in, *endw;
- int j;
+ unsigned long j;
size_t k;
+
+ if (!len)
+ return NULL;
+
k = len;
if (k % 3)
k += 3 - (k % 3);
@@ -2024,7 +2028,9 @@ base64_encode(const unsigned char *src, size_t len)
if (k + 1 < len)
return NULL;
- w = GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(k + 1);
+ w = GC_MALLOC_ATOMIC(k + 1);
+ if (!w)
+ return NULL;
w[k] = 0;
at = w;