Skip to content

Commit

Permalink
Use memmove() instead of memcpy() since regions may overlap.
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Sep 18, 2017
1 parent d88b5f2 commit 589cc78
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rtpp_command_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,11 @@ rtpp_cmd_queue_run(void *arg)
rtpp_cmd_connection_dtor(psp->rccs[i]);
psp->pfds_used--;
if (psp->pfds_used > 0 && i < psp->pfds_used) {
memcpy(&psp->pfds[i], &psp->pfds[i + 1],
memmove(&psp->pfds[i], &psp->pfds[i + 1],
(psp->pfds_used - i) * sizeof(struct pollfd));
memcpy(&psp->rccs[i], &psp->rccs[i + 1],
memmove(&psp->rccs[i], &psp->rccs[i + 1],
(psp->pfds_used - i) * sizeof(struct rtpp_ctrl_connection *));
i--;
}
}
}
Expand Down

0 comments on commit 589cc78

Please sign in to comment.