systemd-hwdb: fix unsigned and signed comparison problem

...
uint8_t c;
struct trie_node *child;

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].
This commit is contained in:
huyubiao
2023-09-26 14:46:55 +08:00
committed by Luca Boccassi
parent 5808300c44
commit b53a80966e

View File

@@ -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++) {