summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast/pff/multipath.c
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2022-02-17 20:22:33 +0100
committerSander Vrijders <[email protected]>2022-02-18 08:43:15 +0100
commit5b61e1f163afcb292185ede20c4682ef5ea92081 (patch)
treedb93bac402d8c06a39183a1344ad4c351e05e5a9 /src/ipcpd/unicast/pff/multipath.c
parentc8d38bc1d9d578a884d4aa661a928c53c18d77fd (diff)
downloadouroboros-5b61e1f163afcb292185ede20c4682ef5ea92081.tar.gz
ouroboros-5b61e1f163afcb292185ede20c4682ef5ea92081.zip
ipcpd: Fix hashing and overlapping memcpy in pff
The pft hash function assumed mem_hash allocates memory, but it does not. There was also a memcpy with potentially overlapping memory regions, which is undefined behaviour. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
Diffstat (limited to 'src/ipcpd/unicast/pff/multipath.c')
-rw-r--r--src/ipcpd/unicast/pff/multipath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ipcpd/unicast/pff/multipath.c b/src/ipcpd/unicast/pff/multipath.c
index b03ce32f..0579b3a0 100644
--- a/src/ipcpd/unicast/pff/multipath.c
+++ b/src/ipcpd/unicast/pff/multipath.c
@@ -191,7 +191,7 @@ int multipath_pff_nhop(struct pff_i * pff_i,
assert(len > 0);
/* Rotate fds left. */
- memcpy(fds, fds + 1, (len - 1) * sizeof(*fds));
+ memmove(fds, fds + 1, (len - 1) * sizeof(*fds));
fds[len - 1] = fd;
pthread_rwlock_unlock(&pff_i->lock);