net: ipv6: fixed endian issue
A cast made assumption on how data is stored. This commit makes the following test pass on qemu_leon3: - net.udp Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
This commit is contained in:
parent
634b8fd58c
commit
3658f74d17
|
@ -172,11 +172,15 @@ static inline int ipv6_handle_ext_hdr_options(struct net_pkt *pkt,
|
|||
uint16_t exthdr_len = 0U;
|
||||
uint16_t length = 0U;
|
||||
|
||||
if (net_pkt_read_u8(pkt, (uint8_t *)&exthdr_len)) {
|
||||
return -ENOBUFS;
|
||||
{
|
||||
uint8_t val = 0U;
|
||||
|
||||
if (net_pkt_read_u8(pkt, &val)) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
exthdr_len = val * 8U + 8;
|
||||
}
|
||||
|
||||
exthdr_len = exthdr_len * 8U + 8;
|
||||
if (exthdr_len > pkt_len) {
|
||||
NET_DBG("Corrupted packet, extension header %d too long "
|
||||
"(max %d bytes)", exthdr_len, pkt_len);
|
||||
|
|
Loading…
Reference in New Issue