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>
This commit is contained in:
parent
713acc316d
commit
59fa06ac74
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user