mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #3074 from authmillenon/ng_ipv6_ext/fix/exit-early
ng_ipv6_ext: exit early on invalid size
This commit is contained in:
commit
41aad42d8f
@ -71,6 +71,10 @@ ng_pktsnip_t *ng_ipv6_ext_build(ng_pktsnip_t *ipv6, ng_pktsnip_t *next,
|
||||
ng_pktsnip_t *prev = NULL, *snip;
|
||||
ng_ipv6_ext_t *ext;
|
||||
|
||||
if (size < NG_IPV6_EXT_LEN_UNIT) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ipv6 != NULL) {
|
||||
LL_SEARCH_SCALAR(ipv6, prev, next, next);
|
||||
|
||||
@ -79,10 +83,6 @@ ng_pktsnip_t *ng_ipv6_ext_build(ng_pktsnip_t *ipv6, ng_pktsnip_t *next,
|
||||
}
|
||||
}
|
||||
|
||||
if (size < NG_IPV6_EXT_LEN_UNIT) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
snip = ng_pktbuf_add(next, NULL, size, NG_NETTYPE_IPV6);
|
||||
|
||||
if (snip == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user