Skip to content
Permalink
Browse files

net: sockets: Do not call NULL socket callback function

Before calling socket callback function, make sure the callback
function exists so that we do not get NULL pointer reference.

Fixes #18021

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information...
jukkar committed Aug 2, 2019
1 parent 34180d3 commit abdd58ce3c657c15dab119d807fcbb1b6799570d
Showing with 1 addition and 1 deletion.
  1. +1 −1 subsys/net/lib/sockets/sockets.c
@@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(net_sock, CONFIG_NET_SOCKETS_LOG_LEVEL);
do { \
const struct socket_op_vtable *vtable; \
void *ctx = get_sock_vtable(sock, &vtable); \
if (ctx == NULL) { \
if (ctx == NULL || vtable->fn == NULL) { \
return -1; \
} \
return vtable->fn(ctx, __VA_ARGS__); \

0 comments on commit abdd58c

Please sign in to comment.
You can’t perform that action at this time.