SOURCES (DEVEL): ircd-va_list.patch (NEW) - on some archs va_list ...

Jakub Bogusz qboosh at pld-linux.org
Thu Oct 21 09:44:50 CEST 2004


On Thu, Oct 21, 2004 at 06:29:39AM +0000, hawk wrote:
> Author: hawk                         Date: Thu Oct 21 06:29:39 2004 GMT
> Module: SOURCES                       Tag: DEVEL
> ---- Log message:
> - on some archs va_list is struct not object

and on others it's just pointer, so...

> ================================================================
> Index: SOURCES/ircd-va_list.patch
> diff -u /dev/null SOURCES/ircd-va_list.patch:1.1.2.1
> --- /dev/null	Thu Oct 21 06:29:39 2004
> +++ SOURCES/ircd-va_list.patch	Thu Oct 21 06:29:34 2004
> @@ -0,0 +1,26 @@
> +diff -ur irc2.11.0b14.orig/support/configure irc2.11.0b14/support/configure
> +--- irc2.11.0b14.orig/support/configure	2004-09-29 00:42:08.000000000 +0200
> ++++ irc2.11.0b14/support/configure	2004-10-21 08:23:57.234789328 +0200
> +@@ -7973,7 +7973,8 @@
> +     return level1(data, format, ap);
> +   else {
> +     if(rounds == 2) {
> +-      va_list ap2 = ap;
> ++      va_list ap2;
> ++      ap2[0] = ap[0];
> +       char *arg = va_arg(ap2, char *);
> +       strcpy(buf1, arg);
> +     }
> +diff -ur irc2.11.0b14.orig/support/configure.in irc2.11.0b14/support/configure.in
> +--- irc2.11.0b14.orig/support/configure.in	2004-09-29 00:42:08.000000000 +0200
> ++++ irc2.11.0b14/support/configure.in	2004-10-21 08:24:40.542205600 +0200
> +@@ -512,7 +512,8 @@
> +     return level1(data, format, ap);
> +   else {
> +     if(rounds == 2) {
> +-      va_list ap2 = ap;
> ++      va_list ap2;
> ++      ap2[0] = ap[0];
> +       char *arg = va_arg(ap2, char *);
> +       strcpy(buf1, arg);
> +     }
> ================================================================

... ap2[0] would be writing to
memory referrenced by some uninitialized pointer.

No assumptions should be made about what va_list actually is.
Use va_copy() macro to clone va_list.


-- 
Jakub Bogusz    http://cyber.cs.net.pl/~qboosh/




More information about the pld-devel-en mailing list