]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode/null: fix type parsing
authorVictor Julien <victor@inliniac.net>
Mon, 23 Nov 2020 20:59:18 +0000 (21:59 +0100)
committerShivani Bhardwaj <shivanib134@gmail.com>
Thu, 3 Dec 2020 22:39:55 +0000 (04:09 +0530)
(cherry picked from commit 14aacbd067c483c72578a86c78d16253b7dc3e93)

src/decode-null.c

index b42f50a53cc019e946da9afab861c59006c6fdf8..50b506c1828f319c4ac7961960b54456711ca75a 100644 (file)
@@ -58,8 +58,11 @@ int DecodeNull(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
     if (unlikely(GET_PKT_LEN(p) > HDR_SIZE + USHRT_MAX)) {
         return TM_ECODE_FAILED;
     }
-
+#if __BYTE_ORDER__ == __BIG_ENDIAN
+    uint32_t type = pkt[0] | pkt[1] << 8 | pkt[2] << 16 | pkt[3] << 24;
+#else
     uint32_t type = *((uint32_t *)pkt);
+#endif
     switch(type) {
         case AF_INET:
             SCLogDebug("IPV4 Packet");