Skip to content

Commit

Permalink
[send/recv] fix invalid memory access when checking channel values
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 Jun 19, 2016
1 parent 2492227 commit 4f1e71c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libknet/threads_send_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,9 @@ static void _handle_send_to_links(knet_handle_t knet_h, int sockfd, int8_t chann
return;
}

if ((channel < KNET_DATAFD_MAX) && (!knet_h->sockfd[channel].is_socket)) {
if ((channel >= 0) &&
(channel < KNET_DATAFD_MAX) &&
(!knet_h->sockfd[channel].is_socket)) {
memset(&iov_in, 0, sizeof(iov_in));
iov_in.iov_base = (void *)knet_h->recv_from_sock_buf[0]->khp_data_userdata;
iov_in.iov_len = KNET_MAX_PACKET_SIZE;
Expand Down

0 comments on commit 4f1e71c

Please sign in to comment.