From: Guy Harris Date: Tue, 25 Aug 2015 01:14:55 +0000 (-0700) Subject: Don't assume the ONC RPC header is nicely aligned. X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/29abfcd8648aeb99bee8e27839f1bda6b65efb49 Don't assume the ONC RPC header is nicely aligned. 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. --- diff --git a/print-nfs.c b/print-nfs.c index dd2f7f12..af8b6fc0 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -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 {