fix base64: add terminating nullbyte
authorJann Horn <jann@thejh.net>
Sat, 27 Jul 2013 10:21:23 +0000 (12:21 +0200)
committerJann Horn <jann@thejh.net>
Sat, 27 Jul 2013 10:21:23 +0000 (12:21 +0200)
base64.c

index 3d70903..2ad5eb7 100644 (file)
--- a/base64.c
+++ b/base64.c
@@ -12,7 +12,7 @@ static char b64_encchr(unsigned char c) {
 // hold the base64-encoded form of the input.
 PUBLIC_FN void base64_encode(char *dst, unsigned char *src, size_t len) {
 start:;
-  if (len == 0) return;
+  if (len == 0) { *dst = '\0'; return; }
   unsigned char a=src[0], b=0, c=0;
   len--, src++;
   int eqsigns = (len<2)?(2-len):0;