summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-11-11 14:59:54 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-11-11 14:59:54 -0500
commit712b13756a09014ef730c8f9b96da4dc2f09b762 (patch)
tree79117c04624d79ae4d4d007f95c228377c046fb5 /src
parent5ce883daaafc69f83b01dac5db0647e9662a6e87 (diff)
downloadbfs-712b13756a09014ef730c8f9b96da4dc2f09b762.tar.xz
exec: Fix index overflow parsing -exec +
Diffstat (limited to 'src')
-rw-r--r--src/exec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/exec.c b/src/exec.c
index 759582e..a1cbde1 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -173,7 +173,7 @@ struct bfs_exec *bfs_exec_parse(const struct bfs_ctx *ctx, char **argv, enum bfs
goto fail;
} else if (strcmp(arg, ";") == 0) {
break;
- } else if (strcmp(arg, "+") == 0) {
+ } else if (execbuf->tmpl_argc > 0 && strcmp(arg, "+") == 0) {
const char *prev = execbuf->tmpl_argv[execbuf->tmpl_argc - 1];
if (!(execbuf->flags & BFS_EXEC_CONFIRM) && strcmp(prev, "{}") == 0) {
execbuf->flags |= BFS_EXEC_MULTI;