From: Zbigniew Jędrzejewski-Szmek Date: Sun, 14 May 2017 02:42:08 +0000 (-0400) Subject: journald: use unaligned_read instead of memcpy X-Git-Tag: v234~183^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=731e10f3c588a31936454d3207155c497219d99a;p=platform%2Fupstream%2Fsystemd.git journald: use unaligned_read instead of memcpy --- diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index c9bf383..d839e04 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -40,6 +40,7 @@ #include "selinux-util.h" #include "socket-util.h" #include "string-util.h" +#include "unaligned.h" bool valid_user_field(const char *p, size_t l, bool allow_protected) { const char *a; @@ -218,7 +219,6 @@ void server_process_native_message( p = e + 1; continue; } else { - le64_t l_le; uint64_t l; char *k; @@ -227,8 +227,7 @@ void server_process_native_message( break; } - memcpy(&l_le, e + 1, sizeof(uint64_t)); - l = le64toh(l_le); + l = unaligned_read_le64(e + 1); if (l > DATA_SIZE_MAX) { log_debug("Received binary data block of %"PRIu64" bytes is too large, ignoring.", l);