From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21770 invoked by alias); 9 Jul 2015 07:00:23 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35743 Received: (qmail 13857 invoked from network); 9 Jul 2015 07:00:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 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== MIME-Version: 1.0 X-Received: by 10.107.136.89 with SMTP id k86mr24340652iod.53.1436425218040; Thu, 09 Jul 2015 00:00:18 -0700 (PDT) In-Reply-To: <150708224339.ZM12390@torch.brasslantern.com> References: <1436366383-23389-1-git-send-email-mikachu@gmail.com> <1436367975-2945-1-git-send-email-mikachu@gmail.com> <150708224339.ZM12390@torch.brasslantern.com> Date: Thu, 9 Jul 2015 09:00:17 +0200 Message-ID: Subject: Re: PATCH: ztrftime: Handle all non-zsh format chars with strftime if present (v2) From: Mikael Magnusson To: Bart Schaefer Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On Thu, Jul 9, 2015 at 7:43 AM, Bart Schaefer 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