Package: apt-build
Version: 0.12.17
Severity: normal

It seems that there is a little bug in the apt-build-wrapper; when
parsing the configuration file, the first malloc is well done, but
after, the realloc call misses the (MAKE_ARGC > GCC_ARGC ? MAKE_ARGC :
GCC_ARGC) thing.
As a consequence, the argv array given in parameter to execvp may
contain weird data (in my case, one of the arguments was just "").

Patch attached, cheers


-manu

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (300, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages apt-build depends on:
ii  apt                           0.6.45     Advanced front-end for dpkg
ii  apt-utils                     0.6.45     APT utility programs
ii  debconf [debconf-2.0]         1.5.3      Debian configuration management sy
ii  devscripts                    2.9.20     Scripts to make the life of a Debi
ii  dpkg-dev                      1.13.22    package building tools for Debian
ii  g++                           4:4.1.1-5  The GNU C++ compiler
ii  gcc                           4:4.1.1-5  The GNU C compiler
ii  libappconfig-perl             1.56-2     Perl module for configuration file
ii  libapt-pkg-perl               0.1.20     Perl interface to libapt-pkg
ii  perl                          5.8.8-6    Larry Wall's Practical Extraction 

Versions of packages apt-build recommends:
ii  build-essential               11.3       informational list of build-essent
ii  fakeroot                      1.5.10     Gives a fake root environment

-- debconf information:
  apt-build/arch_alpha: ev4
  apt-build/arch_arm: armv2
* apt-build/olevel: Medium
* apt-build/build_dir: /var/cache/apt-build/build
  apt-build/arch_sparc: sparc
  apt-build/arch_amd: k6
* apt-build/options: -ftree-vectorize -msse2 -pipe -frename-registers -fweb 
-ffast-math -m64
  apt-build/arch_intel: pentium
* apt-build/make_options:
* apt-build/repository_dir: /var/cache/apt-build/repository
* apt-build/arch_amd64: k8
* apt-build/add_to_sourceslist: true
diff -Naur apt-build-0.12.17/apt-build.h apt-build-0.12.17-manu/apt-build.h
--- apt-build-0.12.17/apt-build.h	2005-12-11 18:05:25.000000000 +0100
+++ apt-build-0.12.17-manu/apt-build.h	2006-08-05 21:40:58.000000000 +0200
@@ -5,6 +5,7 @@
 
 #define MAKE_ARGC 0
 #define GCC_ARGC 2
+#define MAX_ARGC (MAKE_ARGC > GCC_ARGC ? MAKE_ARGC : GCC_ARGC)
 
 #define BUF_SIZE 1024
 
diff -Naur apt-build-0.12.17/config.c apt-build-0.12.17-manu/config.c
--- apt-build-0.12.17/config.c	2006-01-07 23:50:25.000000000 +0100
+++ apt-build-0.12.17-manu/config.c	2006-08-05 21:41:27.000000000 +0200
@@ -97,7 +97,7 @@
 
   /* Build the new command line */
   cmd_line_args =
-    (char **) malloc (sizeof (char *) * (argc + (MAKE_ARGC > GCC_ARGC ? MAKE_ARGC : GCC_ARGC) + 1));
+    (char **) malloc (sizeof (char *) * (argc + MAX_ARGC + 1));
 
   cmd_line_args[nb_apt_build_options++] = strdup (argv[0]);
 
@@ -121,7 +121,7 @@
 	  {
 		cmd_line_args = (char **)
 	    realloc (cmd_line_args,
-		     sizeof (char *) * (argc + nb_apt_build_options + 1));
+		     sizeof (char *) * (argc + MAX_ARGC + nb_apt_build_options + 1));
 	  cmd_line_args[nb_apt_build_options++] = strdup (str);
 	  }
 	  while((str = strtok(NULL, " ")));

Reply via email to