diff --git a/src/flb_log_event_decoder.c b/src/flb_log_event_decoder.c index 53cf1c63412..3e8ca6e56d4 100644 --- a/src/flb_log_event_decoder.c +++ b/src/flb_log_event_decoder.c @@ -19,6 +19,7 @@ #include #include +#include static int create_empty_map(struct flb_log_event_decoder *context) { msgpack_packer packer; @@ -179,8 +180,15 @@ int flb_log_event_decoder_decode_timestamp(msgpack_object *input, return FLB_EVENT_DECODER_ERROR_WRONG_TIMESTAMP_TYPE; } - output->tm.tv_sec = (int32_t) FLB_BSWAP_32(*((uint32_t *) &input->via.ext.ptr[0])); - output->tm.tv_nsec = (int32_t) FLB_BSWAP_32(*((uint32_t *) &input->via.ext.ptr[4])); + output->tm.tv_sec = + (int32_t) FLB_BSWAP_32( + FLB_ALIGNED_DWORD_READ( + (unsigned char *) &input->via.ext.ptr[0])); + + output->tm.tv_nsec = + (int32_t) FLB_BSWAP_32( + FLB_ALIGNED_DWORD_READ( + (unsigned char *) &input->via.ext.ptr[4])); } else { return FLB_EVENT_DECODER_ERROR_WRONG_TIMESTAMP_TYPE;