Skip to content

Commit

Permalink
[sctp] revalidate fd to make coverity scan happy
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Aug 21, 2019
1 parent cc630fe commit 5dd7bbf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libknet/transport_sctp.c
Expand Up @@ -611,6 +611,13 @@ static void _handle_connected_sctp_errors(knet_handle_t knet_h)
return;
}

/*
* revalidate sockfd
*/
if ((sockfd < 0) || (sockfd >= KNET_MAX_FDS)) {
return;
}

log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Processing connected error on socket: %d", sockfd);

info = knet_h->knet_transport_fd_tracker[sockfd].data;
Expand Down Expand Up @@ -839,6 +846,13 @@ static void _handle_listen_sctp_errors(knet_handle_t knet_h)
return;
}

/*
* revalidate sockfd
*/
if ((sockfd < 0) || (sockfd >= KNET_MAX_FDS)) {
return;
}

log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Processing listen error on socket: %d", sockfd);

accept_info = knet_h->knet_transport_fd_tracker[sockfd].data;
Expand Down

0 comments on commit 5dd7bbf

Please sign in to comment.