ref: 2efcc154a4bcef08882a718cdd6e8972dd660719
parent: 66c512248c5cda63b04e2c74e35d5711756b180f
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Mar 9 10:24:02 EDT 2020
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.
--- a/sys/src/cmd/rc/here.c
+++ b/sys/src/cmd/rc/here.c
@@ -22,9 +22,13 @@
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;
--
⑨