From 285fb555d09a932657e98cf8c1ba43f089703333 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Tue, 30 Apr 2019 06:22:07 -0600 Subject: [PATCH] net/socket/getsockname.c: Fix addrlen check in socket debug features. Getsockname checked erroneously a pointer agains 0, where the intention was to dereference the pointer and to check the length. This causes also a compilation failure if the code is compiled with CONFIG_DEBUG_FEATURES and with -Werror flag set. --- net/socket/getsockname.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/socket/getsockname.c b/net/socket/getsockname.c index 30d019f142..2647edf54f 100644 --- a/net/socket/getsockname.c +++ b/net/socket/getsockname.c @@ -105,7 +105,7 @@ int psock_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, FAR s */ #ifdef CONFIG_DEBUG_FEATURES - if (addr == NULL || addrlen <= 0) + if (addr == NULL || *addrlen <= 0) { return -EINVAL; }