[hackers] [sbase][PATCH] printf: Fix string format string length calculation

From: Santtu Lakkala <inz_AT_inz.fi>
Date: Thu, 20 Nov 2025 17:51:01 +0200

---
 printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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);
-- 
2.42.0
Received on Thu Nov 20 2025 - 16:51:01 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 20 2025 - 17:00:39 CET