zsh-workers
 help / color / mirror / code / Atom feed
From: Ricky Zhou <ricky@rzhou.org>
To: zsh-workers@zsh.org
Subject: [PATCH] Correct isident false positive.
Date: Sun, 16 Jan 2011 07:05:20 -0500	[thread overview]
Message-ID: <20110116120519.GA10298@alpha.rzhou.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 663 bytes --]

I'm not familiar with with the precise definition of an identifier, so
somebody might want to double-check that this change (which assumes that
valid identifiers cannot start with a '[') is correct.  This fixes the
following crash:

printf %n '[0]'

---
 Src/params.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Src/params.c b/Src/params.c
index 8510b92..ba6cd63 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1009,6 +1009,8 @@ isident(char *s)
      * definitely not a valid identifier.         */
     if (!*ss)
 	return 1;
+    if (s == ss)
+	return 0;
     if (*ss != '[')
 	return 0;
 
-- 
1.7.3.4


[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

             reply	other threads:[~2011-01-16 12:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-16 12:05 Ricky Zhou [this message]
2011-01-16 19:43 ` Peter Stephenson

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=20110116120519.GA10298@alpha.rzhou.org \
    --to=ricky@rzhou.org \
    --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).