Skip to content

Commit 23c6721

Browse files
jbedardgregmagolan
andcommitted
fix(cli): make isFlagInFlagSet more robust incase it is called with '--' (#7029)
### Changes are visible to end-users: no ### Test plan CI Co-authored-by: Greg Magolan <greg@aspect.dev> GitOrigin-RevId: 72ca500133f72b926bee8df1f476c928ea3ff0cd
1 parent bd2863c commit 23c6721

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/aspect/root/flags/interceptor.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ func isFlagInFlagSet(flags *pflag.FlagSet, arg string) bool {
3636
var flag *pflag.Flag
3737
if arg[0] == '-' {
3838
if arg[1] == '-' {
39+
if len(arg) <= 2 {
40+
return false
41+
}
3942
flag = flags.Lookup(strings.SplitN(arg[2:], "=", 2)[0])
4043
} else {
4144
for _, s := range arg[1:] {

0 commit comments

Comments
 (0)