public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Georgy Yakovlev" <gyakovlev@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-arch/dpkg/files/, app-arch/dpkg/
Date: Wed,  4 Jan 2023 01:09:03 +0000 (UTC)	[thread overview]
Message-ID: <1672794515.b7cdb9f1997d5123ad92ac9f17079b7e67e52f29.gyakovlev@gentoo> (raw)

commit:     b7cdb9f1997d5123ad92ac9f17079b7e67e52f29
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  4 01:08:02 2023 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Wed Jan  4 01:08:35 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7cdb9f1

app-arch/dpkg: replace buf patch with upstream fix in 1.21.15

Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 ...{dpkg-1.21.15.ebuild => dpkg-1.21.15-r1.ebuild} |  2 +-
 app-arch/dpkg/files/dpkg-1.21.15-buf-lengh.patch   | 34 ----------------
 .../dpkg/files/dpkg-1.21.15-buf-overflow.patch     | 45 ++++++++++++++++++++++
 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
similarity index 97%
rename from app-arch/dpkg/dpkg-1.21.15.ebuild
rename to 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
+


             reply	other threads:[~2023-01-04  1:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04  1:09 Georgy Yakovlev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-24 20:37 [gentoo-commits] repo/gentoo:master commit in: app-arch/dpkg/files/, app-arch/dpkg/ Sam James
2024-12-24 20:37 Sam James
2023-01-04  9:09 Georgy Yakovlev
2023-01-03  6:48 Georgy Yakovlev
2022-11-22  7:20 Georgy Yakovlev
2021-06-09  6:16 Georgy Yakovlev
2020-07-09  9:52 Jeroen Roovers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1672794515.b7cdb9f1997d5123ad92ac9f17079b7e67e52f29.gyakovlev@gentoo \
    --to=gyakovlev@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox