From: Martin Mares Date: Sat, 4 Mar 2023 15:02:43 +0000 (+0100) Subject: Filters: Allow leading "0x" for backward compatibility X-Git-Tag: v3.10.0~16 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a9f51446fe43f39455df116723b64bb44c916c1e;p=pciutils.git Filters: Allow leading "0x" for backward compatibility --- 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++;