zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: syntax check of 'echo $HOME' crashes in ksh emulation mode
Date: Tue, 06 Oct 2015 10:15:49 +0100	[thread overview]
Message-ID: <20151006101549.3664bab3@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20151006093357.0c7a5214@pwslap01u.europe.root.pri>

On Tue, 6 Oct 2015 09:33:57 +0100
Peter Stephenson <p.stephenson@samsung.com> wrote:
> On Mon, 5 Oct 2015 10:45:07 -0700
> Bart Schaefer <schaefer@brasslantern.com> wrote:
> > Hrm.  But we DO set HOME in ksh emulation if the -n option is not given.
> > What is it about no_exec that changes things?
> 
> Not importing environment variables.

Digging deeper, I think where it's not doing the assignment is...


/**/
mod_export void
assignstrvalue(Value v, char *val, int flags)
{
    if (unset(EXECOPT))
	return;


(i) Doesn't that leak val?  Presumably if val is non-NULL it's
permanently allocated, and I don't think we can guarantee that never
happens.  Indeed, as far as I can see in the case we're talking about it
does happen.

(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,
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.  So this is all a
bit nasty.  (Just for once.)

pws


  reply	other threads:[~2015-10-06  9:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-05 16:09 Kamil Dudka
2015-10-05 16:42 ` Peter Stephenson
2015-10-05 17:45   ` Bart Schaefer
2015-10-06  8:33     ` Peter Stephenson
2015-10-06  9:15       ` Peter Stephenson [this message]
2015-10-06 15:34         ` Bart Schaefer
2015-10-06 19:46           ` Peter Stephenson
2015-10-07  8:26             ` Peter Stephenson
2015-10-08 12:13   ` Kamil Dudka
2015-10-05 20:45 ` Axel Beckert

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=20151006101549.3664bab3@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --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).