Skip to content
Snippets Groups Projects
Commit ff74a195 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

Add input parameters check to netio functions

refs #2137
parent 4f5000e1
Branches
Tags
No related merge requests found
......@@ -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;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment