zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: syntax check of 'echo $HOME' crashes in ksh emulation mode
Date: Tue, 6 Oct 2015 08:34:46 -0700	[thread overview]
Message-ID: <151006083446.ZM5523@torch.brasslantern.com> (raw)
In-Reply-To: <20151006101549.3664bab3@pwslap01u.europe.root.pri>

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.


  reply	other threads:[~2015-10-06 15:34 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
2015-10-06 15:34         ` Bart Schaefer [this message]
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=151006083446.ZM5523@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).