[hackers] [sbase] printf: Fix string format string length calculation || Santtu Lakkala
commit 9c9da834c37dbab7780f3307bfc367862d35e8cd
Author: Santtu Lakkala <inz_AT_inz.fi>
AuthorDate: Thu Nov 20 17:51:01 2025 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
CommitDate: Thu Nov 20 18:31:59 2025 +0100
printf: Fix string format string length calculation
diff --git a/printf.c b/printf.c
index e36a14f..ee4a9ba 100644
--- a/printf.c
+++ b/printf.c
_AT_@ -131,7 +131,7 @@ main(int argc, char *argv[])
free(rarg);
break;
case 's':
- fmt = emalloc(sizeof("%*.*s" + nflags));
+ fmt = emalloc(sizeof("%*.*s") + nflags);
sprintf(fmt, "%%%.*s*.*s", (int)nflags, &format[f]);
printf(fmt, width, precision, arg);
free(fmt);
Received on Thu Nov 20 2025 - 18:32:24 CET
This archive was generated by hypermail 2.3.0
: Thu Nov 20 2025 - 18:36:36 CET