commit: be763a7ece0c9e98519839ac31ecf5b8be619012
parent: 7a5f8be9f46ec5eaa34dcf3488737184c3b8b564
author: Brian Callahan <bcallah@openbsd.org>
date: Mon, 5 Jul 2021 10:04:38 -0400
Sync with OpenBSD
CVSROOT: /cvs
Module name: src
Changes by: millert@cvs.openbsd.org 2021/07/05 07:41:46
Modified files:
bin/ksh : syn.c
Log message:
Do not permit an empty list between "while" and "do".
This avoids a cpu loop for "while do done" and is consistent with
the behavior of AT&T ksh and most other shells. OK jca@ halex@
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/syn.c b/syn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syn.c,v 1.39 2018/04/24 08:25:16 kn Exp $ */
+/* $OpenBSD: syn.c,v 1.40 2021/07/05 13:41:46 millert Exp $ */
/*
* shell parser (C version)
@@ -331,6 +331,8 @@ get_command(int cf)
nesting_push(&old_nesting, c);
t = newtp((c == WHILE) ? TWHILE : TUNTIL);
t->left = c_list(true);
+ if (t->left == NULL)
+ syntaxerr(NULL);
t->right = dogroup();
nesting_pop(&old_nesting);
break;