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

[PATCH] Correct isident false positive.



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: pgpWQ7gvX6aNM.pgp
Description: PGP signature



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