From 2e1b90f1070095d277b4e35bd923422fc0ddb16b Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Tue, 18 Aug 2015 17:53:11 +0200 Subject: [PATCH 1/2] rpl: added assertions for null pointer checks --- sys/net/routing/ng_rpl/ng_rpl.c | 3 +++ sys/net/routing/ng_rpl/ng_rpl_control_messages.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/sys/net/routing/ng_rpl/ng_rpl.c b/sys/net/routing/ng_rpl/ng_rpl.c index 2f8e1c798b7b..3666cdc8de8f 100644 --- a/sys/net/routing/ng_rpl/ng_rpl.c +++ b/sys/net/routing/ng_rpl/ng_rpl.c @@ -150,6 +150,9 @@ static void _receive(ng_pktsnip_t *icmpv6) ng_icmpv6_hdr_t *icmpv6_hdr = NULL; LL_SEARCH_SCALAR(icmpv6, ipv6, type, NG_NETTYPE_IPV6); + + assert(ipv6 != NULL); + ipv6_hdr = (ipv6_hdr_t *)ipv6->data; icmpv6_hdr = (ng_icmpv6_hdr_t *)icmpv6->data; diff --git a/sys/net/routing/ng_rpl/ng_rpl_control_messages.c b/sys/net/routing/ng_rpl/ng_rpl_control_messages.c index e98cd6ee5c9b..8820eed47d71 100644 --- a/sys/net/routing/ng_rpl/ng_rpl_control_messages.c +++ b/sys/net/routing/ng_rpl/ng_rpl_control_messages.c @@ -401,6 +401,9 @@ void ng_rpl_recv_DIO(ng_rpl_dio_t *dio, ipv6_addr_t *src, uint16_t len) trickle_increment_counter(&dodag->trickle); } + /* ng_rpl_parent_add_by_addr should have set this already */ + assert(parent != NULL); + parent->rank = byteorder_ntohs(dio->rank); if(!_parse_options(NG_RPL_ICMPV6_CODE_DIO, dodag, (ng_rpl_opt_t *)(dio + 1), len, NULL)) { From 687cc6e17527011e8a3260266d53aef7a0a8f85a Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Tue, 18 Aug 2015 17:53:29 +0200 Subject: [PATCH 2/2] rpl: removed superfluous assignment --- sys/net/routing/ng_rpl/ng_rpl_control_messages.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/net/routing/ng_rpl/ng_rpl_control_messages.c b/sys/net/routing/ng_rpl/ng_rpl_control_messages.c index 8820eed47d71..ad7f93325524 100644 --- a/sys/net/routing/ng_rpl/ng_rpl_control_messages.c +++ b/sys/net/routing/ng_rpl/ng_rpl_control_messages.c @@ -135,7 +135,6 @@ void ng_rpl_send_DIO(ng_rpl_dodag_t *dodag, ipv6_addr_t *destination) dodag_conf->reserved = 0; dodag_conf->default_lifetime = dodag->default_lifetime; dodag_conf->lifetime_unit = byteorder_htons(dodag->lifetime_unit); - pos += sizeof(*dodag_conf); } dodag->dodag_conf_counter++;