summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-hwdb.c
diff options
context:
space:
mode:
authorEric Benoit <eric@ecks.ca>2012-12-11 15:32:39 +0100
committerKay Sievers <kay@vrfy.org>2012-12-11 15:34:56 +0100
commitf4443fa5976eca51661947dd4df60847213f27fa (patch)
treead52349487b3f0049c0b6a499e5309c8e4c760c9 /src/libudev/libudev-hwdb.c
parentdecd634e801bee2c554edb35383cc9d43417a850 (diff)
libudev: hwdb: add missing endianess conversion
https://bugs.freedesktop.org/show_bug.cgi?id=58067
Diffstat (limited to 'src/libudev/libudev-hwdb.c')
-rw-r--r--src/libudev/libudev-hwdb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
index 12c8214ec5..09096c4d71 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -169,8 +169,8 @@ static int trie_fnmatch_f(struct udev_hwdb *hwdb, const struct trie_node_f *node
linebuf_rem_char(buf);
}
- if (node->values_count && fnmatch(linebuf_get(buf), search, 0) == 0)
- for (i = 0; i < node->values_count; i++) {
+ if (le64toh(node->values_count) && fnmatch(linebuf_get(buf), search, 0) == 0)
+ for (i = 0; i < le64toh(node->values_count); i++) {
err = hwdb_add_property(hwdb, trie_string(hwdb, trie_node_values(hwdb, node)[i].key_off),
trie_string(hwdb, trie_node_values(hwdb, node)[i].value_off));
if (err < 0)
@@ -236,7 +236,7 @@ static int trie_search_f(struct udev_hwdb *hwdb, const char *search) {
if (search[i] == '\0') {
size_t n;
- for (n = 0; n < node->values_count; n++) {
+ for (n = 0; n < le64toh(node->values_count); n++) {
err = hwdb_add_property(hwdb, trie_string(hwdb, trie_node_values(hwdb, node)[n].key_off),
trie_string(hwdb, trie_node_values(hwdb, node)[n].value_off));
if (err < 0)