From 3e97b749f4ccee5bbfb1da1441b4b2cbe7eb2328 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 6 Dec 2010 10:49:51 +0000 Subject: 28486: $compstate[parameter] needs untokenizing --- Src/Zle/compcore.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Src/Zle/compcore.c') diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index ee44c46ef..415f91f79 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -648,6 +648,17 @@ callcompfunc(char *s, char *fn) else compredirs = (char **) zshcalloc(sizeof(char *)); + /* + * We need to untokenize compparameter which is the + * raw internals of a parameter subscript. + * + * The double memory duplication is a bit ugly: the additional + * dupstring() is necessary because untokenize() might change + * the string length and so later zsfree() would get the wrong + * length of the string. + */ + compparameter = dupstring(compparameter); + untokenize(compparameter); compparameter = ztrdup(compparameter); compredirect = ztrdup(compredirect); zsfree(compquote); -- cgit 1.4.1