From: Jouni Malinen Date: Tue, 7 Jul 2015 12:33:55 +0000 (+0300) Subject: NFC: Avoid misaligned read of an NDEF field X-Git-Tag: hostap_2_5~465 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc880b11ed70ff9dcf8be48621f75d354cc5094d;p=thirdparty%2Fhostap.git NFC: Avoid misaligned read of an NDEF field The 32-bit version of payload length field may not be 32-bit aligned in the message buffer, so use WPA_GET_BE32() to read it instead of ntohl(). Signed-off-by: Jouni Malinen --- diff --git a/src/wps/ndef.c b/src/wps/ndef.c index 8d1ce1eac..5604b0a5d 100644 --- a/src/wps/ndef.c +++ b/src/wps/ndef.c @@ -47,7 +47,7 @@ static int ndef_parse_record(const u8 *data, u32 size, } else { if (size < 6) return -1; - record->payload_length = ntohl(*(u32 *)pos); + record->payload_length = WPA_GET_BE32(pos); pos += sizeof(u32); }