From dc3a2ffc4ad9e97fc63d432ee860584339c01ee8 Mon Sep 17 00:00:00 2001 From: FRIGN Date: Sun, 15 Feb 2015 15:20:32 +0100 Subject: [PATCH] Handle empty format string in printf(1) --- printf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/printf.c b/printf.c index bfd8670..ec5d441 100644 --- a/printf.c +++ b/printf.c @@ -32,7 +32,8 @@ int main(int argc, char *argv[]) cooldown = 1; } formatlen = unescape(format); - + if (formatlen == 0) + return 0; lastargi = 0; for (i = 0, argi = 2; !cooldown || i < formatlen; i++, i = cooldown ? i : (i % formatlen)) { if (i == 0) {