aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc.c7
-rw-r--r--proto.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/etc.c b/etc.c
index 7fabd03..0c3a004 100644
--- a/etc.c
+++ b/etc.c
@@ -2009,18 +2009,19 @@ static char Base64Table[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
char *
-base64_encode(const unsigned char *src, int len)
+base64_encode(const unsigned char *src, size_t len)
{
unsigned char *w, *at;
const unsigned char *in, *endw;
- int j, k;
+ int j;
+ size_t k;
k = len;
if (k % 3)
k += 3 - (k % 3);
k = k / 3 * 4;
- if (k < len)
+ if (k + 1 < len)
return NULL;
w = GC_MALLOC_ATOMIC(k + 1);
diff --git a/proto.h b/proto.h
index 6aafbb4..899eec8 100644
--- a/proto.h
+++ b/proto.h
@@ -829,4 +829,4 @@ void srand48(long);
long lrand48(void);
#endif
-extern char *base64_encode(const unsigned char *src, int len);
+extern char *base64_encode(const unsigned char *src, size_t len);