diff options
author | Martin Mares <mj@ucw.cz> | 2023-03-04 16:02:43 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2023-03-04 16:02:43 +0100 |
commit | a9f51446fe43f39455df116723b64bb44c916c1e (patch) | |
tree | 4141708fd7cedb9357bff0128e65fdf7c31409b4 | |
parent | 2d16e3a7875a9cb5abd60713bb2e39b536a7dec4 (diff) | |
download | pciutils-a9f51446fe43f39455df116723b64bb44c916c1e.tar.gz |
Filters: Allow leading "0x" for backward compatibility
-rw-r--r-- | lib/filter.c | 5 |
1 files changed, 5 insertions, 0 deletions
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++; |