roken: Fix base64(1) crash on empty file

This commit is contained in:
Nicolas Williams
2022-01-17 17:42:17 -06:00
parent dd71303a2f
commit 68ddc50020

View File

@@ -241,7 +241,7 @@ main(int argc, char **argv)
if (fwrite(d, ret, 1, stdout) != 1)
err(1, "Could not write decoded data");
free(d);
} else {
} else if (buf) { /* buf can be NULL if we read from an empty file */
char *e;
if ((ret = rk_base64_encode(buf, buflen, &e)) < 0)