shithub: scc

Download patch

ref: 89e72c2d2d478536697490f2427a2d429ce72983
parent: 52ef32b73c4bb6a8a039a5c72d7c81b953953262
author: Quentin Rameau <quinq@fifth.space>
date: Fri May 8 15:54:58 EDT 2020

libc: remove non-C99 strnlen usage in vfprintf

--- a/src/libc/stdio/vfprintf.c
+++ b/src/libc/stdio/vfprintf.c
@@ -350,7 +350,8 @@
 				goto wstrout;
 			} else {
 				s = va_arg(va2, char *);
-				len = strnlen(s, conv.prec);
+				if ((len = strlen(s)) > conv.prec)
+					len = conv.prec;
 				goto strout;
 			}
 		wstrout: