diff options
author | Ori Bernstein <ori@eigenstate.org> | 2020-03-09 14:24:02 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2020-03-09 14:24:02 -0700 |
commit | fc90f7a666da0b1634797d8596e8fdd4bbeba956 (patch) | |
tree | bce75d34283d2a9fcb004a33e89c0993efda68f0 | |
parent | 698837e7150af19ff6a3f0bf2144dffc81202a55 (diff) | |
download | plan9front-fc90f7a666da0b1634797d8596e8fdd4bbeba956.tar.xz |
fix heredoc crash
we emitted an error on heredoc tags, but we
continued on, and added a heredoc entry to
the list, with a tag that we couldn't handle.
when processing this heredoc, rc would segfault.
fix: don't add a heredoc to the list on error.
-rw-r--r-- | sys/src/cmd/rc/here.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/src/cmd/rc/here.c b/sys/src/cmd/rc/here.c index 922911f80..3ee8d6395 100644 --- a/sys/src/cmd/rc/here.c +++ b/sys/src/cmd/rc/here.c @@ -22,9 +22,13 @@ hexnum(char *p, int n) tree* heredoc(tree *tag) { - struct here *h = new(struct here); - if(tag->type!=WORD) + struct here *h; + + if(tag->type!=WORD){ yyerror("Bad here tag"); + return nil; + } + h = new(struct here); h->next = 0; if(here) *ehere = h; |