Skip to content

Commit dc4b6f8

Browse files
whotkeszybz
authored andcommitted
sd-hwdb: fix matching for characters with an ord > 127
Devices like the "Microsoft Microsoft® 2.4GHz Transceiver v9.0 Mouse" contain characters higher than 127. That ® is correctly stored in the hwdb and passed into the search field during query, but the comparison fails. Our search string is a const char *, trie_string() returns a const char * but the current character is cast to uint8_t. This causes anything over 127 to fail the match. Fix this, we're dealing with characters everywhere here after all.
1 parent 0471921 commit dc4b6f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libsystemd/sd-hwdb/sd-hwdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static int trie_search_f(sd_hwdb *hwdb, const char *search) {
240240
size_t p = 0;
241241

242242
if (node->prefix_off) {
243-
uint8_t c;
243+
char c;
244244

245245
for (; (c = trie_string(hwdb, node->prefix_off)[p]); p++) {
246246
if (IN_SET(c, '*', '?', '['))

0 commit comments

Comments
 (0)