The following commit has been merged in the squeeze branch:
commit 420c62ccbf88e7c961e586946eb1464e9ede2a31
Author: Guillem Jover <[email protected]>
Date: Fri Feb 4 18:59:00 2011 +0100
dpkg: Do not segfault on “dpkg -i --no-act”
Cherry picked from commit da5fceca72b4c67be8acdb0734dbf7c241519dff.
mkdtemp() takes the string allocated by path_make_temp_template() and
modifies it, but there's not enough allocated room for the subsequent
string appends done starting from cidirrest, for the control files.
Regression introduced in commit ffccc65580189420a0a64736bba0fb661de56dcb.
diff --git a/debian/changelog b/debian/changelog
index 852be90..0bd3b0e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ dpkg (1.15.8.11) UNRELEASED; urgency=low
[ Guillem Jover ]
* Fix build failure when passing --disable-nls to configure.
+ * Do not segfault on “dpkg -i --no-act”.
[ Updated man page translations ]
* German (Helge Kreutzmann). Minor fixe(s).
diff --git a/src/processarc.c b/src/processarc.c
index e2d2a30..0b33b25 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -193,14 +193,21 @@ void process_archive(const char *filename) {
if (f_noact) {
+ char *tmpdir;
+
if (!cidirbuf)
free(cidirbuf);
- cidir = cidirbuf = mkdtemp(path_make_temp_template("dpkg"));
- if (!cidir)
+ tmpdir = mkdtemp(path_make_temp_template("dpkg"));
+ if (!tmpdir)
ohshite(_("unable to create temporary directory"));
+
+ cidir = cidirbuf = m_malloc(strlen(tmpdir) + MAXCONTROLFILENAME + 10);
+ strcpy(cidir, tmpdir);
strcat(cidir,"/");
cidirrest = cidir + strlen(cidir);
+
+ free(tmpdir);
} else {
/* We want it to be on the same filesystem so that we can
* use rename(2) to install the postinst &c.
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]