1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

flag: fix array boundary check

This commit is contained in:
Alexander Medvednikov 2020-03-06 02:02:32 +01:00 committed by GitHub
parent efb45579aa
commit 7a92a47eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,7 +156,7 @@ fn (fs mut FlagParser) parse_value(longhand string, shorthand byte) []string {
continue
}
if (arg.len == 2 && arg[0] == `-` && arg[1] == shorthand ) || arg == full {
if i+1 > fs.args.len {
if i+1 >= fs.args.len {
panic("Missing argument for '$longhand'")
}
nextarg := fs.args[i+1]