[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#211850: dpkg: --print-architecture segfaults when "gcc -dumpmachine" returns a non-matching triplet



tags 211850 + patch
thanks

Moi!

The segfault is due to dereferencing an unused and uninitialised pointer
variable in main/enquiry.c::printarch(). This is fixed in the attached
patch. There's also a second hunk that adds a new ia64 mapping to
archtable. This is needed with the new -dumpmachine output from gcc 3.4
on ia64. Please apply.

Thanks,

Daniel.

diff -ur dpkg-1.10.21/archtable dpkg-1.10.21.new/archtable
--- dpkg-1.10.21/archtable	2004-03-08 19:29:13.000000000 +0100
+++ dpkg-1.10.21.new/archtable	2004-04-30 13:28:29.944470230 +0200
@@ -40,6 +40,7 @@
 i686-gnu0.3		hurd-i386	undefined
 ia64-linux-gnu		ia64		ia64
 ia64-unknown-linux	ia64		ia64
+ia64-unknown-linux-gnu	ia64		ia64
 sh3-linux-gnu		sh3		sh3
 sh4-linux-gnu		sh4		sh4
 sh3eb-linux-gnu		sh3eb		sh3eb
diff -ur dpkg-1.10.21/main/enquiry.c dpkg-1.10.21.new/main/enquiry.c
--- dpkg-1.10.21/main/enquiry.c	2003-10-25 22:03:21.000000000 +0200
+++ dpkg-1.10.21.new/main/enquiry.c	2004-04-30 13:24:19.198268202 +0200
@@ -402,7 +402,7 @@
   FILE *ccpipe;
   struct varbuf vb;
   ptrdiff_t ll;
-  char *p, *q;
+  char *p;
 
   if (*argv) badusage(_("--print-architecture does not take any argument"));
 
@@ -445,7 +445,7 @@
   default: internerr("unknown action in printarch");
   }
   if (!arch) {
-    *q= 0; arch= p;
+    arch= p;
     fprintf(stderr, _("dpkg: warning, architecture `%s' not in remapping table\n"),arch);
   }
   if (printf("%s\n",arch) == EOF) werr("stdout");

Reply to: