X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Ffilter.c;h=0301f49f93ff76e6a29f6d781817c2dfd4f83886;hb=327b6e8a1660e1c937b7987fa31f972af393521b;hp=703845156c5d75c26a96e4b986bb95bf587daffa;hpb=de53aa4fd7777a2602882bb7d4304e0b2ad6bc6f;p=pciutils.git diff --git a/lib/filter.c b/lib/filter.c index 7038451..0301f49 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -3,7 +3,9 @@ * * Copyright (c) 1998--2022 Martin Mares * - * Can be freely distributed and used under the terms of the GNU GPL. + * Can be freely distributed and used under the terms of the GNU GPL v2+. + * + * SPDX-License-Identifier: GPL-2.0-or-later */ #include @@ -76,6 +78,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++;