From b53a80966e8a2d68b66bf1b47c2ee633a71fad49 Mon Sep 17 00:00:00 2001 From: huyubiao Date: Tue, 26 Sep 2023 14:46:55 +0800 Subject: [PATCH] systemd-hwdb: fix unsigned and signed comparison problem ... uint8_t c; struct trie_node *child; MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit for (p = 0; (c = trie->strings->buf[node->prefix_off + p]); p++) { _cleanup_free_ struct trie_node *new_child = NULL; _cleanup_free_ char *s = NULL; ssize_t off; if (c == search[i + p]) continue; ... When '®' is present in search, c is 194, search[i + p] is -62, c is not equal to search[i + p], but c should be equal to search[i + p]. --- src/shared/hwdb-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/hwdb-util.c b/src/shared/hwdb-util.c index 12621b7f89d..f67e917b533 100644 --- a/src/shared/hwdb-util.c +++ b/src/shared/hwdb-util.c @@ -193,7 +193,7 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se for (size_t i = 0;; i++) { size_t p; - uint8_t c; + char c; struct trie_node *child; for (p = 0; (c = trie->strings->buf[node->prefix_off + p]); p++) { -- 2.47.3