jcs's openbsd hax
openbsd

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@

millert 4685f242 49c3446e

+3 -1
+3 -1
bin/ksh/syn.c
··· 1 - /* $OpenBSD: syn.c,v 1.39 2018/04/24 08:25:16 kn Exp $ */ 1 + /* $OpenBSD: syn.c,v 1.40 2021/07/05 13:41:46 millert Exp $ */ 2 2 3 3 /* 4 4 * shell parser (C version) ··· 331 331 nesting_push(&old_nesting, c); 332 332 t = newtp((c == WHILE) ? TWHILE : TUNTIL); 333 333 t->left = c_list(true); 334 + if (t->left == NULL) 335 + syntaxerr(NULL); 334 336 t->right = dogroup(); 335 337 nesting_pop(&old_nesting); 336 338 break;