From 3df7e283e38d9fee7ca5a450599e5b6fca9d284e Mon Sep 17 00:00:00 2001 From: Ryan Breaker Date: Tue, 24 Oct 2017 19:46:12 -0500 Subject: [PATCH] Prevent mismatch of cases in ranges --- netbox/utilities/forms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index 964524f09..b0e741080 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -87,8 +87,11 @@ def parse_alphanumeric_range(string): for dash_range in string.split(','): try: begin, end = dash_range.split('-') + # Skip if incompatible types or mixed case, just like any other bad pattern if (str.isalpha(begin) and str.isdigit(end)) or (str.isdigit(begin) and str.isalpha(end)): - continue # Skip if it's invalid, just like any other bad pattern + continue + if not (str.isupper(begin + end) or str.islower(begin + end)): + continue except ValueError: begin, end = dash_range, dash_range nums = list(range(ord(begin), ord(end)+1))