[PATCH] fix(libc): Fix handle of %E & %O modifiers at end of format string

Pedro Luis Castedo Cepeda pedroluis.castedo@upm.es
Thu Nov 9 19:04:41 GMT 2023


- Prevent strftime to parsing format string beyond its end when
  it finish with "%E" or "%O".
---
 newlib/libc/time/strftime.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c
index 56f227c5f..c4e9e45a9 100644
--- a/newlib/libc/time/strftime.c
+++ b/newlib/libc/time/strftime.c
@@ -754,6 +754,8 @@ __strftime (CHAR *s, size_t maxsize, const CHAR *format,
 
       switch (*format)
 	{
+	case CQ('\0'):
+	  break;
 	case CQ('a'):
 	  _ctloc (wday[tim_p->tm_wday]);
 	  for (i = 0; i < ctloclen; i++)
-- 
2.42.1



More information about the Cygwin-patches mailing list