roken: Fix base32(1) crash on empty file

This commit is contained in:
Nicolas Williams
2022-01-17 17:43:23 -06:00
parent 68ddc50020
commit b4f9c8772b

View File

@@ -298,7 +298,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_base32_encode(buf, buflen, &e, flags)) < 0)