summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Yakovlev <gyakovlev@gentoo.org>2023-01-03 17:08:02 -0800
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2023-01-03 17:08:35 -0800
commitb7cdb9f1997d5123ad92ac9f17079b7e67e52f29 (patch)
treed75191a98090df9c6e902d072a0ea30cc686c35a /app-arch/dpkg
parentnet-misc/you-get: update DISTUTILS_USE_PEP517 (diff)
downloadgentoo-b7cdb9f1997d5123ad92ac9f17079b7e67e52f29.tar.gz
gentoo-b7cdb9f1997d5123ad92ac9f17079b7e67e52f29.tar.bz2
gentoo-b7cdb9f1997d5123ad92ac9f17079b7e67e52f29.zip
app-arch/dpkg: replace buf patch with upstream fix in 1.21.15
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'app-arch/dpkg')
-rw-r--r--app-arch/dpkg/dpkg-1.21.15-r1.ebuild (renamed from app-arch/dpkg/dpkg-1.21.15.ebuild)2
-rw-r--r--app-arch/dpkg/files/dpkg-1.21.15-buf-lengh.patch34
-rw-r--r--app-arch/dpkg/files/dpkg-1.21.15-buf-overflow.patch45
3 files changed, 46 insertions, 35 deletions
diff --git a/app-arch/dpkg/dpkg-1.21.15.ebuild b/app-arch/dpkg/dpkg-1.21.15-r1.ebuild
index 02e4f4a95589..d26e233149be 100644
--- a/app-arch/dpkg/dpkg-1.21.15.ebuild
+++ b/app-arch/dpkg/dpkg-1.21.15-r1.ebuild
@@ -46,7 +46,7 @@ BDEPEND="
PATCHES=(
"${FILESDIR}"/${PN}-1.18.12-flags.patch
- "${FILESDIR}"/${PN}-1.21.15-buf-lengh.patch # sent upstream
+ "${FILESDIR}"/${P}-buf-overflow.patch
)
src_prepare() {
diff --git a/app-arch/dpkg/files/dpkg-1.21.15-buf-lengh.patch b/app-arch/dpkg/files/dpkg-1.21.15-buf-lengh.patch
deleted file mode 100644
index 1ab28d1df5a0..000000000000
--- a/app-arch/dpkg/files/dpkg-1.21.15-buf-lengh.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 7caf70b6cda200e1bad77c26e46e465a4ad76d71 Mon Sep 17 00:00:00 2001
-From: Georgy Yakovlev <gyakovlev@gentoo.org>
-Date: Mon, 2 Jan 2023 21:57:29 -0800
-Subject: [PATCH] dpkg-deb: increase buf lengh in movecontrolfiles
-
-In some cases limit of 200 is too short.
-For example, on gentoo we build in /var/tmp/portage (user configurable)
-
-the buf contents end up exactly 201 characters:
-e.g.: "mv /long/path /another/long/path && rmdir /yet/another/long/path"
-
-so we only catch it in testsuite and dpkg-deb tests fail sometimes.
-
-Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
----
- src/deb/extract.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/deb/extract.c b/src/deb/extract.c
-index a098539..332c664 100644
---- a/src/deb/extract.c
-+++ b/src/deb/extract.c
-@@ -53,7 +53,7 @@
- static void
- movecontrolfiles(const char *dir, const char *thing)
- {
-- char buf[200];
-+ char buf[512];
- pid_t pid;
-
- sprintf(buf, "mv %s/%s/* %s/ && rmdir %s/%s", dir, thing, dir, dir, thing);
---
-2.39.0
-
diff --git a/app-arch/dpkg/files/dpkg-1.21.15-buf-overflow.patch b/app-arch/dpkg/files/dpkg-1.21.15-buf-overflow.patch
new file mode 100644
index 000000000000..864d57b98a5c
--- /dev/null
+++ b/app-arch/dpkg/files/dpkg-1.21.15-buf-overflow.patch
@@ -0,0 +1,45 @@
+From 5356621172d669d8f62e7e746a6c7a11345aec4e Mon Sep 17 00:00:00 2001
+From: Guillem Jover <guillem@debian.org>
+Date: Tue, 3 Jan 2023 23:29:05 +0100
+Subject: dpkg-deb: Fix buffer overflow on long directory names with old deb
+ formats
+
+The handling for deb 0.x formats that relocates files around once
+extracted was using a buffer with a hardcoded size, not taking into
+account the length of the directory which would overflow it.
+
+Switch to use a dynamically allocated buffer to handle any destination
+directory length.
+
+Reported-by: Georgy Yakovlev <gyakovlev@gentoo.org>
+---
+ src/deb/extract.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/deb/extract.c b/src/deb/extract.c
+index a09853962..6466fa6f2 100644
+--- a/src/deb/extract.c
++++ b/src/deb/extract.c
+@@ -53,15 +53,16 @@
+ static void
+ movecontrolfiles(const char *dir, const char *thing)
+ {
+- char buf[200];
++ char *cmd;
+ pid_t pid;
+
+- sprintf(buf, "mv %s/%s/* %s/ && rmdir %s/%s", dir, thing, dir, dir, thing);
++ cmd = str_fmt("mv %s/%s/* %s/ && rmdir %s/%s", dir, thing, dir, dir, thing);
+ pid = subproc_fork();
+ if (pid == 0) {
+- command_shell(buf, _("shell command to move files"));
++ command_shell(cmd, _("shell command to move files"));
+ }
+ subproc_reap(pid, _("shell command to move files"), 0);
++ free(cmd);
+ }
+
+ static void DPKG_ATTR_NORET
+--
+cgit v1.2.3
+