The following commit has been merged in the master branch:
commit da5fceca72b4c67be8acdb0734dbf7c241519dff
Author: Guillem Jover <[email protected]>
Date: Fri Feb 4 18:59:00 2011 +0100
dpkg: Do not segfault on “dpkg -i --no-act”
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 ad43296..0b6c245 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,7 @@ dpkg (1.16.0) UNRELEASED; urgency=low
* By default reject installing packages w/o an Architecture field. They
now need --force-architecture, dpkg will still warn about them though.
* Fix build failure when passing --disable-nls to configure.
+ * Do not segfault on “dpkg -i --no-act”.
[ Raphaël Hertzog ]
* Fail properly when debian/source/format is empty. Closes: #600854
diff --git a/src/processarc.c b/src/processarc.c
index f7675e6..e7a9047 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -219,14 +219,21 @@ void process_archive(const char *filename) {
deb_verify(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]