Skip to content

Commit a678987

Browse files
huyubiaobluca
authored andcommitted
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]. (cherry picked from commit b53a809) (cherry picked from commit 3cc2aa3)
1 parent b60cf1f commit a678987

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shared/hwdb-util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se
193193

194194
for (size_t i = 0;; i++) {
195195
size_t p;
196-
uint8_t c;
196+
char c;
197197
struct trie_node *child;
198198

199199
for (p = 0; (c = trie->strings->buf[node->prefix_off + p]); p++) {

0 commit comments

Comments
 (0)