summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/cmd/auth/pemencode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/src/cmd/auth/pemencode.c b/sys/src/cmd/auth/pemencode.c
index b6e886fa5..24df22cf4 100644
--- a/sys/src/cmd/auth/pemencode.c
+++ b/sys/src/cmd/auth/pemencode.c
@@ -48,11 +48,11 @@ main(int argc, char **argv)
break;
tot += n;
}
- buf[tot] = 0;
- cbuf = malloc(2*tot);
+ len = 2*tot+3;
+ cbuf = malloc(len);
if(cbuf == nil)
sysfatal("malloc: %r");
- len = enc64(cbuf, 2*tot, (uchar*)buf, tot);
+ len = enc64(cbuf, len, (uchar*)buf, tot);
print("-----BEGIN %s-----\n", tag);
while(len > 0){
print("%.64s\n", cbuf);