On 2023-11-09 12:04, Pedro Luis Castedo Cepeda wrote:
- 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++)

These cases appear to already be taken care of by setting and using (depending on the config parameters) the "alt" variable for those modifiers, and the default: return 0; for the format *character* (possibly wide) not matching following any modifiers.

Patches to newlib should go to the newlib mailing list at sourceware dot org.

--
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                -- Antoine de Saint-Exupéry

Reply via email to