Merge branch 'coverity_scan_defects' into 'master'

Fix issues flag by Coverity:

See merge request openconnect/ocserv!144
This commit is contained in:
Nikos Mavrogiannopoulos
2020-03-05 19:26:32 +00:00
2 changed files with 3 additions and 2 deletions

View File

@@ -1146,7 +1146,7 @@ static void listen_watcher_cb (EV_P_ ev_io *w, int revents)
hmac_components[0].data = ws->remote_ip_str;
hmac_components[0].length = strlen(ws->remote_ip_str);
hmac_components[1].data = ws->our_ip_str;
hmac_components[1].length = ws->our_ip_str ? strlen(ws->our_ip_str) : 0;
hmac_components[1].length = strlen(ws->our_ip_str);
hmac_components[2].data = &ws->session_start_time;
hmac_components[2].length = sizeof(ws->session_start_time);

View File

@@ -780,7 +780,8 @@ int handle_sec_auth_init(int cfd, sec_mod_st *sec, const SecAuthInitMsg *req, pi
/* Authenticate the client parameters */
hmac_components[0].data = req->ip;
hmac_components[0].length = req->ip ? strlen(req->ip) : 0;
// req->ip is required and protobuf doesn't permit null for required parameters
hmac_components[0].length = strlen(req->ip);
hmac_components[1].data = req->our_ip;
hmac_components[1].length = req->our_ip ? strlen(req->our_ip) : 0;
hmac_components[2].data = (void*)&req->session_start_time;