From cfff612229d7a4ed4990223e64e45376f94aefd5 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 8 Oct 2016 08:24:38 +0000 Subject: bugfix: tryexec -n segfaulted with empty remainder (thanks muhmuhten) --- src/execline/tryexec.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/execline/tryexec.c b/src/execline/tryexec.c index 46d3479..0612210 100644 --- a/src/execline/tryexec.c +++ b/src/execline/tryexec.c @@ -39,6 +39,8 @@ int main (int argc, char const **argv, char const *const *envp) int argc1 = el_semicolon(argv) ; if (!argc1) strerr_dief1x(100, "empty block") ; if (argc1 >= argc) strerr_dief1x(100, "unterminated block") ; + if (not && argc1 == argc - 1) + strerr_dief1x(100, "empty remainder not allowed with -n") ; argv[argc1] = 0 ; dom = argv + not * (argc1 + 1) ; sub = argv + !not * (argc1 + 1) ; -- cgit v1.2.3