diff options
author | Frederic Crozat <fcrozat@suse.com> | 2012-03-16 11:59:04 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-03-22 01:09:37 +0100 |
commit | 4fd052aede13eb3041277c54ac2f5dee6e6c29cf (patch) | |
tree | a78001fa71f8e01e262123dfabebe3a23b41f8b7 /src/journal/journald.c | |
parent | 170dcb7bd575f61aa75ce55d7fc0183ace6b8b76 (diff) |
add sparse support to detect endianness bug
le16/32/64_t type should be used when storing little-endian value
header to integrate with sparse from Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'src/journal/journald.c')
-rw-r--r-- | src/journal/journald.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c index 87390bdec9..f0f5103bf0 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -1258,6 +1258,7 @@ static void process_native_message( p = e + 1; continue; } else { + le64_t l_le; uint64_t l; char *k; @@ -1266,8 +1267,8 @@ static void process_native_message( break; } - memcpy(&l, e + 1, sizeof(uint64_t)); - l = le64toh(l); + memcpy(&l_le, e + 1, sizeof(uint64_t)); + l = le64toh(l_le); if (remaining < e - p + 1 + sizeof(uint64_t) + l + 1 || e[1+sizeof(uint64_t)+l] != '\n') { |