summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch')
-rw-r--r--meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch b/meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch
new file mode 100644
index 0000000000..f9b809d167
--- /dev/null
+++ b/meta/recipes-devtools/rpm/files/0001-Duplicate-filename-before-passing-it-to-basename.patch
@@ -0,0 +1,40 @@
1From 3fa2ae78db9b31edb4c22f3b5cd36c6c972947f1 Mon Sep 17 00:00:00 2001
2From: Florian Festi <ffesti@redhat.com>
3Date: Wed, 26 Jul 2023 15:01:35 +0200
4Subject: [PATCH] Duplicate filename before passing it to basename
5
6basename is allowed change the string passed to it. While we don't need
7the filename after that just casting away the const seems a bit too
8hacky.
9
10Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/3fa2ae78db9b31edb4c22f3b5cd36c6c972947f1]
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 tools/rpmuncompress.c | 4 +++-
14 1 file changed, 3 insertions(+), 1 deletion(-)
15
16diff --git a/tools/rpmuncompress.c b/tools/rpmuncompress.c
17index 58ddf5683..e13cc6a66 100644
18--- a/tools/rpmuncompress.c
19+++ b/tools/rpmuncompress.c
20@@ -98,7 +98,8 @@ static char *doUntar(const char *fn)
21 if (needtar) {
22 rasprintf(&buf, "%s '%s' | %s %s -", zipper, fn, tar, taropts);
23 } else if (at->compressed == COMPRESSED_GEM) {
24- const char *bn = basename(fn);
25+ char *tmp = xstrdup(fn);
26+ const char *bn = basename(tmp);
27 size_t nvlen = strlen(bn) - 3;
28 char *gem = rpmGetPath("%{__gem}", NULL);
29 char *gemspec = NULL;
30@@ -112,6 +113,7 @@ static char *doUntar(const char *fn)
31
32 free(gemspec);
33 free(gem);
34+ free(tmp);
35 } else {
36 rasprintf(&buf, "%s '%s'", zipper, fn);
37 }
38--
392.43.0
40