zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: PATCH: ztrftime: Handle all non-zsh format chars with strftime if present (v2)
Date: Thu, 9 Jul 2015 09:00:17 +0200	[thread overview]
Message-ID: <CAHYJk3RV+VJyMs0G1iJfD3KYOOCsrqb9P96_-5zKG2DMMf2dtg@mail.gmail.com> (raw)
In-Reply-To: <150708224339.ZM12390@torch.brasslantern.com>

On Thu, Jul 9, 2015 at 7:43 AM, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 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.

No, I think you're right. However, I can't get it to fail with my
current code either. It seems better to do the fmt++ only in the true
case though.

-- 
Mikael Magnusson


      reply	other threads:[~2015-07-09  7:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4FE37754-AA20-405E-8925-6C4F9E0043AE@kba.biglobe.ne.jp>
2015-07-08 14:39 ` PATCH: ztrftime: Handle all non-zsh format chars with strftime if present Mikael Magnusson
2015-07-08 15:06   ` PATCH: ztrftime: Handle all non-zsh format chars with strftime if present (v2) Mikael Magnusson
2015-07-09  4:31     ` Mikael Magnusson
2015-07-09  5:43       ` Bart Schaefer
2015-07-09  7:00         ` Mikael Magnusson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHYJk3RV+VJyMs0G1iJfD3KYOOCsrqb9P96_-5zKG2DMMf2dtg@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).