]> 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 01:14:55 +0000 (18:14 -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 50334d10e5ea78ab0778f0ecaf8ebac64b215d13..ac51f7ee1a29a341448c1b5c1f2f5a5c004b56d0 100644 (file)
@@ -932,13 +932,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;
        const struct ip *ip = (const struct ip *)bp;
 #ifdef INET6
        const struct ip6_hdr *ip6 = (const 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 {