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)
- X-seq: zsh-workers 35743
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: PATCH: ztrftime: Handle all non-zsh format chars with strftime if present (v2)
- Date: Thu, 9 Jul 2015 09:00:17 +0200
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=X5qj2osHwzQA9HtCjFXcgwuHPTWh/KpLCjCgFdW1Dqc=; b=dr6iHSyZ8Xe4Mt+ewpsLoq03uU1qM4scYs9Ywn9PH/IvU1doIm11zHg5wgAVCJ4gns 0rzQeCWCp33z1qog6GvFfm4tt5f/hAJjf2sPM/msgrqlHL4ngJQTxuGvmGVGsAU/P6o8 AFkeAVse6/LcmiYgpiyj5EOpnfZsYwwNLaSX5HxV7KjwTRuM73Mpc/abwczCaVfief3O J0KhBmuyBlfiZNpgyv4gIpAl6zSDCatJayWRABOqWpkEoROwROACqRN6r4RMf82n48JM 8PoJyfrLeQ/CqZO10GiTPQhZUv2VCIguOj20YDRxi2bdPhPe51r5GXQ4gQBcvpZrA1uS YVNw==
- In-reply-to: <150708224339.ZM12390@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1436366383-23389-1-git-send-email-mikachu@gmail.com> <1436367975-2945-1-git-send-email-mikachu@gmail.com> <CAHYJk3SgpaEqh2ZeMcCovnP=ykw-y0StSQd_G9q55eVq6M6wuQ@mail.gmail.com> <150708224339.ZM12390@torch.brasslantern.com>
On Thu, Jul 9, 2015 at 7:43 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author