[PATCH] fix(libc): Fix handle of %E & %O modifiers at end of format string
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Nov 10 10:16:25 GMT 2023
On Nov 9 23:17, Brian Inglis wrote:
> 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.
Also, a simple reproducer would be nice.
Thanks,
Corinna
More information about the Cygwin-patches
mailing list