From 4dbdf586887614a334b2af47d6a83f3a5d0ea516 Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Tue, 5 Apr 2022 23:59:33 +0200 Subject: [PATCH] fix: out-of-bounds error in command header This commit fixes an out-of-bound error that happened while parsing commands. Signed-off-by: Moritz Poldrack Acked-by: Robin Jarry --- commands/compose/header.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commands/compose/header.go b/commands/compose/header.go index 59b1caa..fc0a81b 100644 --- a/commands/compose/header.go +++ b/commands/compose/header.go @@ -1,6 +1,7 @@ package compose import ( + "errors" "fmt" "strings" @@ -44,6 +45,11 @@ func (Header) Execute(aerc *widgets.Aerc, args []string) error { if err != nil { return err } + + if len(args) < optind+1 { + return errors.New("command parsing failed") + } + var ( force bool = false )