From 474d50f3b47170abab3a8f1c742a03387696ccb2 Mon Sep 17 00:00:00 2001 From: Sam James Date: Sun, 12 Oct 2025 07:54:44 +0100 Subject: [PATCH] app-benchmarks/httperf: fix memcpy UB I meant to include this in 5507c2df5d98f518edd20ca590e7a33e5c75f0ec. Signed-off-by: Sam James --- ...tperf-0.9.1_p20201206-memcpy-overlap.patch | 36 +++++++++++++++++++ ...uild => httperf-0.9.1_p20201206-r1.ebuild} | 1 + 2 files changed, 37 insertions(+) create mode 100644 app-benchmarks/httperf/files/httperf-0.9.1_p20201206-memcpy-overlap.patch rename app-benchmarks/httperf/{httperf-0.9.1_p20201206.ebuild => httperf-0.9.1_p20201206-r1.ebuild} (93%) diff --git a/app-benchmarks/httperf/files/httperf-0.9.1_p20201206-memcpy-overlap.patch b/app-benchmarks/httperf/files/httperf-0.9.1_p20201206-memcpy-overlap.patch new file mode 100644 index 0000000000000..ca78e98cbc699 --- /dev/null +++ b/app-benchmarks/httperf/files/httperf-0.9.1_p20201206-memcpy-overlap.patch @@ -0,0 +1,36 @@ +https://github.com/httperf/httperf/pull/81 + +From c0e7d018ec0f5d10029e07e6eababb8dc86b4603 Mon Sep 17 00:00:00 2001 +From: Raphael Isemann +Date: Wed, 20 Apr 2022 13:30:05 +0200 +Subject: [PATCH] Fix UB when memcpy'ing overlapping buffers + +memcpy doesn't allow overlapping src/dst so instead using memmove here to fix +that the buffer gets corrupted. +--- + src/gen/wsesspage.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/gen/wsesspage.c b/src/gen/wsesspage.c +index 46b697d..267188a 100755 +--- a/src/gen/wsesspage.c ++++ b/src/gen/wsesspage.c +@@ -369,7 +369,7 @@ call_recv_data (Event_Type et, Object *obj, Any_Type regarg, Any_Type callarg) + } + else + { +- memcpy (cpriv->buf, cpriv->buf + 1, 3); ++ memmove (cpriv->buf, cpriv->buf + 1, 3); + cpriv->buf_len = 3; + } + } +@@ -391,7 +391,7 @@ call_recv_data (Event_Type et, Object *obj, Any_Type regarg, Any_Type callarg) + } + else + { +- memcpy (cpriv->buf, cpriv->buf + 1, 4); ++ memmove (cpriv->buf, cpriv->buf + 1, 4); + cpriv->buf_len = 4; + } + } + diff --git a/app-benchmarks/httperf/httperf-0.9.1_p20201206.ebuild b/app-benchmarks/httperf/httperf-0.9.1_p20201206-r1.ebuild similarity index 93% rename from app-benchmarks/httperf/httperf-0.9.1_p20201206.ebuild rename to app-benchmarks/httperf/httperf-0.9.1_p20201206-r1.ebuild index 1a2bedf385b5d..54927299dd480 100644 --- a/app-benchmarks/httperf/httperf-0.9.1_p20201206.ebuild +++ b/app-benchmarks/httperf/httperf-0.9.1_p20201206-r1.ebuild @@ -24,6 +24,7 @@ RDEPEND="${DEPEND}" PATCHES=( "${FILESDIR}"/${PN}-0.9.1_p20201206-c23.patch + "${FILESDIR}"/${PN}-0.9.1_p20201206-memcpy-overlap.patch ) src_prepare() {