summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>2017-01-25 14:35:32 +0200
committerJukka Rissanen <jukka.rissanen@linux.intel.com>2017-01-27 12:35:52 +0200
commitc34cb8236e0e6d608d5ee565de7e49c98a6a1490 (patch)
treec64df8de505ef10ab127b96ff5b6afa4d8f289cd
parent404a83a4828374e7cf0b8733fe75db14643c0d43 (diff)
net: ip: Check error conditions and return false
Check if input parameters are valid or not. It might lead to crash NULL address input. Change-Id: Ib446ab0467268bca01f478cca3ece868c7c9e49b Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
-rw-r--r--include/net/net_ip.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/net_ip.h b/include/net/net_ip.h
index e055d71c9..c285cf2c9 100644
--- a/include/net/net_ip.h
+++ b/include/net/net_ip.h
@@ -688,6 +688,10 @@ static inline void net_ipv6_addr_create_iid(struct in6_addr *addr,
static inline bool net_ipv6_addr_based_on_ll(const struct in6_addr *addr,
const struct net_linkaddr *lladdr)
{
+ if (!addr || !lladdr) {
+ return false;
+ }
+
switch (lladdr->len) {
case 2:
if (!memcmp(&addr->s6_addr[14], lladdr->addr, lladdr->len) &&