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

Re: syntax check of 'echo $HOME' crashes in ksh emulation mode



On Oct 6, 10:15am, Peter Stephenson wrote:
}
} /**/
} mod_export void
} assignstrvalue(Value v, char *val, int flags)
} {
}     if (unset(EXECOPT))
} 	return;
} 
} (i) Doesn't that leak val?

Probably, but in no_exec state the shell can't possibly run for very long
so it doesn't matter?  However, every other case in assignstrvalue() has
zsfree(val) so this one probably should too.  Except:

} (ii) It's not clear how safe the above is, as this case shows.  However,
} it's definitely not safe to skip the tests in assignstrvalue() either

Do you mean that even for no_exec we should not be bailing out this
early in assignstrvalue()?  That is, we ought to be doing the tests of
read-only, wrong type, invalid subscript, etc., and then bail just
before removing the PM_UNSET flag?  Except:

} and if we run them it's doing too much work for syntax checking and is
} likely to mess things up owing to previous non-execution.

I don't know about too much work, but yes, some of them proceed a bit
too far into semantics.

} So this is all a bit nasty.  (Just for once.)

Does POSIX say anything about the environment in no_exec state?  Maybe
we should just temporarily toggle EXECOPT off during that part of the
shell initialization -- we're already avoiding execution of contents
of environment vars for security reasons, so it should be safe to do
the imports.



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