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

PATCH: Remove incorrect array access that was also never used



c always comes from ingetc() which does this,
	    if (itok(lastc = (unsigned char) *inbufptr++))
		continue;

so it is 1) always in the range 0-255, and 2) never an itok character.

That means that the access ztokens[c - Pound] where Pound is a signed
integer would be accessing an element in the range 164-419 or so, while
ztokens is 30 elements large. Luckily two wrongs made a right here, but
still, remove it.
---
 Src/hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Src/hist.c b/Src/hist.c
index ce5f7c20e6..07358dfe4a 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -410,7 +410,7 @@ iaddtoline(int c)
 	    excs = zlemetacs;
     }
     exlast = inbufct;
-    zleentry(ZLE_CMD_ADD_TO_LINE, itok(c) ? ztokens[c - Pound] : c);
+    zleentry(ZLE_CMD_ADD_TO_LINE, c);
 }
 
 
-- 
2.38.1





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