From a9f51446fe43f39455df116723b64bb44c916c1e Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 4 Mar 2023 16:02:43 +0100 Subject: Filters: Allow leading "0x" for backward compatibility --- lib/filter.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/filter.c b/lib/filter.c index 7038451..86486d3 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -76,6 +76,11 @@ parse_hex_field(char *str, int *outp, unsigned int *maskp, unsigned int max) if (!field_defined(str)) return 1; // and keep the defaults + // Historically, filters allowed writing hexadecimal numbers with leading "0x". + // This was never intentional nor documented, but some people relied on it. + if (!maskp && str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) + str += 2; + while (*str) { int c = *str++; -- cgit v1.2.1