hush: do not allow sh -c '{ echo boo }'
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 7 Nov 2016 15:22:35 +0000 (16:22 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 7 Nov 2016 15:22:35 +0000 (16:22 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c

index 0bc67ecc9ced55f860a12786b9c50992fc341181..a01db9c755cc53a2dc999ee23a907f5782534da9 100644 (file)
@@ -4533,12 +4533,14 @@ static struct pipe *parse_stream(char **pstring,
                                syntax_error_unterm_str("here document");
                                goto parse_error;
                        }
-                       /* end_trigger == '}' case errors out earlier,
-                        * checking only ')' */
                        if (end_trigger == ')') {
                                syntax_error_unterm_ch('(');
                                goto parse_error;
                        }
+                       if (end_trigger == '}') {
+                               syntax_error_unterm_ch('{');
+                               goto parse_error;
+                       }
 
                        if (done_word(&dest, &ctx)) {
                                goto parse_error;