From dc4b6f8d2c84fc1dcbbb250c573ab5902bbf3990 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 8 Feb 2019 10:30:48 +1000 Subject: [PATCH] sd-hwdb: fix matching for characters with an ord > 127 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- src/libsystemd/sd-hwdb/sd-hwdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c index b81786a..233944c 100644 --- a/src/libsystemd/sd-hwdb/sd-hwdb.c +++ b/src/libsystemd/sd-hwdb/sd-hwdb.c @@ -240,7 +240,7 @@ static int trie_search_f(sd_hwdb *hwdb, const char *search) { size_t p = 0; if (node->prefix_off) { - uint8_t c; + char c; for (; (c = trie_string(hwdb, node->prefix_off)[p]); p++) { if (IN_SET(c, '*', '?', '[')) -- 2.7.4