diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-01-17 01:13:54 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-02-07 15:49:08 +0200 |
commit | 59fa06ac74c1736dd1270fadde6a0077877bea04 (patch) | |
tree | 7ea517afe9c077818cfa3bf4a1e3ab41597457e3 /slirp/slirp.c | |
parent | 713acc316ddca119fe168e72846f1d2dd0548430 (diff) |
slirp: Avoid unaligned 16bit memory access
pkt parameter may be unaligned, so we must access it byte-wise.
This fixes sparc64 host SIGBUS during pxe boot.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'slirp/slirp.c')
-rw-r--r-- | slirp/slirp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/slirp/slirp.c b/slirp/slirp.c index a9674ab090..739f364770 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -829,7 +829,7 @@ void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) if (pkt_len < ETH_HLEN) return; - proto = ntohs(*(uint16_t *)(pkt + 12)); + proto = (((uint16_t) pkt[12]) << 8) + pkt[13]; switch(proto) { case ETH_P_ARP: arp_input(slirp, pkt, pkt_len); |