diff --git a/src/utils/common/netio.c b/src/utils/common/netio.c index 786e8bb786901849cc9965f89cb37da4819a3809..69eceb9490c136ca024da484d9c8e0d8caf0142e 100644 --- a/src/utils/common/netio.c +++ b/src/utils/common/netio.c @@ -28,6 +28,10 @@ int get_socktype(const params_t *params, const uint16_t qtype) { + if (params == NULL) { + return KNOT_EINVAL; + } + switch (params->protocol) { case PROTO_TCP: return SOCK_STREAM; @@ -55,6 +59,10 @@ int send_msg(const params_t *params, struct pollfd pfd; int sockfd; + if (params == NULL || query == NULL || server == NULL || buf == NULL) { + return KNOT_EINVAL; + } + memset(&hints, 0, sizeof hints); // Set IP type. @@ -142,6 +150,10 @@ int receive_msg(const params_t *params, ssize_t ret; struct pollfd pfd; + if (params == NULL || query == NULL || buf == NULL) { + return KNOT_EINVAL; + } + // Initialize poll descriptor structure. pfd.fd = sockfd; pfd.events = POLLIN;