Skip to content

Commit 589cc78

Browse files
committed
Use memmove() instead of memcpy() since regions may overlap.
1 parent d88b5f2 commit 589cc78

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/rtpp_command_async.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,11 @@ rtpp_cmd_queue_run(void *arg)
435435
rtpp_cmd_connection_dtor(psp->rccs[i]);
436436
psp->pfds_used--;
437437
if (psp->pfds_used > 0 && i < psp->pfds_used) {
438-
memcpy(&psp->pfds[i], &psp->pfds[i + 1],
438+
memmove(&psp->pfds[i], &psp->pfds[i + 1],
439439
(psp->pfds_used - i) * sizeof(struct pollfd));
440-
memcpy(&psp->rccs[i], &psp->rccs[i + 1],
440+
memmove(&psp->rccs[i], &psp->rccs[i + 1],
441441
(psp->pfds_used - i) * sizeof(struct rtpp_ctrl_connection *));
442+
i--;
442443
}
443444
}
444445
}

0 commit comments

Comments
 (0)