From 5b61e1f163afcb292185ede20c4682ef5ea92081 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 17 Feb 2022 20:22:33 +0100 Subject: 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 Signed-off-by: Sander Vrijders --- src/ipcpd/unicast/pff/multipath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ipcpd/unicast/pff/multipath.c') 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); -- cgit v1.2.3