Skip to content

Commit

Permalink
net: sockets: Do not call NULL socket callback function
Browse files Browse the repository at this point in the history
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 6, 2019
1 parent 34180d3 commit abdd58c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/net/lib/sockets/sockets.c
Expand Up @@ -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__); \
Expand Down

0 comments on commit abdd58c

Please sign in to comment.