about summary refs log tree commit diff stats
path: root/base64decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'base64decode.c')
-rw-r--r--base64decode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/base64decode.c b/base64decode.c
index 625f08f..3e30fb8 100644
--- a/base64decode.c
+++ b/base64decode.c
@@ -12,7 +12,7 @@ usage(void)
 static void 
 decode(int fd, char *name)
 {
-	int n;
+	int n, nb;
 	long tot;
 	char *buf, *outbuf;
 	outbuf = nil;
@@ -29,9 +29,9 @@ decode(int fd, char *name)
 		tot += n;
 	}
 	buf[tot] = 0;
-	print("DEBUG: %d \n", strlen(outbuf));
 	outbuf =  malloc(b64d_size(strlen(buf)));
-	b64_decode(buf, strlen(buf), outbuf);
+	nb = b64_decode(buf, strlen(buf), outbuf);
+	outbuf[nb] = 0;
 	if((n=write(1,  outbuf, strlen(outbuf))) != strlen(outbuf))
 		sysfatal("writing bytes failed");
 }