Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: ztrftime: Handle all non-zsh format chars with strftime if present (v2)



On Jul 9,  6:31am, Mikael Magnusson wrote:
}
} > +               while (*fmt && strchr("OE^#_-0123456789", *fmt++));
} > +               if (*fmt++)
} > +                   goto strftimehandling;
} > +           }
} >             switch (*fmt++) {
} 
} Okay, fun thinko here, should be
} -               while (*fmt && strchr("OE^#_-0123456789", *fmt++));
} +               while (*fmt && strchr("OE^#_-0123456789", *fmt))
} +                   fmt++;

Isn't there still a thinko there?  In the event that the "while" loop
terminates because *fmt == 0, the subsequent "if (*fmt++)" will still
increment fmt past the end of the string, and then "switch (*fmt++)"
becomes an invalid dereference.

Or is that eventuality already prevented by the surrounding code?  I
haven't been applying these patches and still haven't seen the whole
thing in one diff.



Messages sorted by: Reverse Date, Date, Thread, Author