From de858f60d1cbe45cd24f7b65a89f79a2e86acf08 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 23 Jan 2024 02:23:12 +0100 Subject: Disallow h// at the start of patterns --- src/grab.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/grab.c b/src/grab.c index 33943f0..f8f5471 100644 --- a/src/grab.c +++ b/src/grab.c @@ -302,6 +302,8 @@ comppat(char8_t *s) if (s - p == 0) { if (op.c != 'h') diex("Empty regex given to ‘%c’", op.c); + if (ops.len == 0) + diex("Empty ‘h’ is not allowed as the first operator"); op.pat = ops.buf[ops.len - 1].pat; } else op.pat = mkregex(p, s - p); -- cgit v1.2.3