]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Don't assume the ONC RPC header is nicely aligned.
authorGuy Harris <[email protected]>
Tue, 25 Aug 2015 01:14:55 +0000 (18:14 -0700)
committerGuy Harris <[email protected]>
Tue, 25 Aug 2015 18:25:52 +0000 (11:25 -0700)
Use UNALIGNED_MEMCPY() to extract the XID from it; otherwise, this might
crash on machines that require strict alignment (e.g., SPARC machines).

Fixes GitHub issue #478.

print-nfs.c

index dd2f7f12fd2b8033b3e62c29a729a880aff67ac2..af8b6fc0305363b9b976a4ba296eeae0575cf21e 100644 (file)
@@ -933,13 +933,14 @@ xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, uint32_t *proc,
 {
        int i;
        struct xid_map_entry *xmep;
-       uint32_t xid = rp->rm_xid;
+       uint32_t xid;
        struct ip *ip = (struct ip *)bp;
 #ifdef INET6
        struct ip6_hdr *ip6 = (struct ip6_hdr *)bp;
 #endif
        int cmp;
 
+       UNALIGNED_MEMCPY(&xid, &rp->rm_xid, sizeof(xmep->xid));
        /* Start searching from where we last left off */
        i = xid_map_hint;
        do {