From d5463ad9396508cf873a54a2e59c94623d1fcb4b Mon Sep 17 00:00:00 2001 From: Jake Wnuk Date: Thu, 7 Nov 2024 21:45:04 -0500 Subject: [PATCH] hot fix hot fix a validation in IsMakeAFullMask --- pkg/mask/mask.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/mask/mask.go b/pkg/mask/mask.go index c7d3b7d..6f5da9f 100644 --- a/pkg/mask/mask.go +++ b/pkg/mask/mask.go @@ -649,19 +649,22 @@ func CalculateKeyspace(input string) int { // Returns: // (bool): True if the mask is a full mask, false if the mask is a partial mask func IsMaskAFullMask(input string) bool { + if len(input)%2 != 0 { + return false + } + for i := 0; i < len(input); i += 2 { if input[i] != '?' { return false } - if len(input) == 1 { + if i+1 >= len(input) { return false } if input[i+1] != 'u' && input[i+1] != 'l' && input[i+1] != 'd' && input[i+1] != 's' && input[i+1] != 'b' && input[i+1] != 'a' { return false } - } return true