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:
Samuel Thibault 2019-01-17 01:13:54 +01:00
parent 713acc316d
commit 59fa06ac74
1 changed files with 1 additions and 1 deletions

View File

@ -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);