[syslog-ng][aaron@schrab.com: Bug#78445: syslog-ng: The included libol uses va_list incorrectly.]

Andrew Dixon andrew.dixon@seranoa.com
Wed, 26 Sep 2001 17:18:13 -0400


This patch seems to be for the Debian source for syslog-ng.  You don't
have one for the pristine source do you?

Also, does anyone know when/if this patch is going into CVS?

thanks,
Andy

Balazs Scheidler wrote:
> 
> ----- Forwarded message from Aaron Schrab <aaron@schrab.com> -----
> 
> From: Aaron Schrab <aaron@schrab.com>
> To: 78445@bugs.debian.org
> Cc: control@bugs.debian.org
> Reply-To: Aaron Schrab <aaron@schrab.com>, 78445@bugs.debian.org
> Subject: Bug#78445: syslog-ng: The included libol uses va_list incorrectly.
> Date: Sat, 22 Sep 2001 10:47:33 -0500
> 
> tags 78445 patch
> thanks
> 
> The msg_vformat function from libol passes the same va_list to two
> different functions, expecting that the first won't affect the second.
> This assumption isn't true on powerpc, so when the second function gets
> it, there aren't any arguments left to read.
> 
> The included patch fixes this by making a copy of the va_list before
> passing it for the first time.
> 
> I checked for other occurences of this problem, but this seems to be the
> only one.  My patched copy has been handling my logging for a few hours
> now and it seems to work fine.  The unpatched one died immediately.
> 
> *** /tmp/syslog-ng.diff
> diff -Pur syslog-ng-1.5.9/debian/libol.patch syslog-ng-1.5.9.ats/debian/libol.patch
> --- syslog-ng-1.5.9/debian/libol.patch  Wed Dec 31 18:00:00 1969
> +++ syslog-ng-1.5.9.ats/debian/libol.patch      Sat Sep 22 06:06:43 2001
> @@ -0,0 +1,37 @@
> +diff -ur libol-0.2.24.orig/src/format.h libol-0.2.24/src/format.h
> +--- libol-0.2.24.orig/src/format.h     Sat Jul 10 08:23:09 1999
> ++++ libol-0.2.24/src/format.h  Sat Sep 22 05:56:59 2001
> +@@ -28,6 +28,12 @@
> +
> + #include <stdarg.h>
> +
> ++#ifndef va_copy
> ++# ifdef __va_copy
> ++#  define va_copy __va_copy
> ++# endif
> ++#endif
> ++
> + struct ol_string *c_format(const char *format, ...);
> + UINT32 c_format_length(const char *format, ...);
> + UINT32 c_format_write(const char *format, UINT32 length, UINT8 *buffer, ...);
> +diff -ur -x configure libol-0.2.24.orig/src/werror.c libol-0.2.24/src/werror.c
> +--- libol-0.2.24.orig/src/werror.c     Fri Feb  4 13:02:04 2000
> ++++ libol-0.2.24/src/werror.c  Sat Sep 22 05:58:41 2001
> +@@ -117,9 +117,16 @@
> + {
> +       UINT8 errorbuf[BUF_SIZE];
> +       int length;
> +-
> ++#ifdef va_copy
> ++      va_list args_copy;
> ++      va_copy (args_copy, args);
> ++#endif
> ++
> +       length = c_vformat_length(f, args);
> +       if (length <= BUF_SIZE) {
> ++#ifdef va_copy
> ++              va_copy (args, args_copy);
> ++#endif
> +               c_vformat_write(f, sizeof(errorbuf), errorbuf, args);
> +               MSG_WRITE(level, length, errorbuf);
> +       }
> diff -Pur syslog-ng-1.5.9/debian/rules syslog-ng-1.5.9.ats/debian/rules
> --- syslog-ng-1.5.9/debian/rules        Sat Sep 22 06:08:56 2001
> +++ syslog-ng-1.5.9.ats/debian/rules    Sat Sep 22 06:09:13 2001
> @@ -17,7 +17,7 @@
>         rm $(LIBOLDIR)/ltmain.sh $(LIBOLDIR)/config.sub $(LIBOLDIR)/config.guess \
>            $(LIBOLDIR)/aclocal.m4 $(LIBOLDIR)/missing \
>            $(LIBOLDIR)/ltconfig $(LIBOLDIR)/mkinstalldirs
> -       (cd $(LIBOLDIR); ./autogen.sh; ./configure --prefix=/usr/lib; $(MAKE) )
> +       (cd $(LIBOLDIR); patch -p1 < ../debian/libol.patch; ./autogen.sh; ./configure --prefix=/usr/lib; $(MAKE) )
>         echo "libol: Done"
>  #      mv -f ltmain.sh ltmain.sh.save
>  #      mv -f config.sub config.sub.save
> 
> -- System Information
> Debian Release: testing/unstable
> Architecture: powerpc
> Kernel: Linux frell 2.4.10-pre10-ben0 #1 Thu Sep 20 00:45:23 CDT 2001 ppc
> Locale: LANG=C, LC_CTYPE=en_US
> 
> Versions of packages syslog-ng depends on:
> ii  libc6                         2.2.4-1    GNU C Library: Shared libraries an
> 
> ----- End forwarded message -----
> 
> --
> Bazsi
> PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
> 
> _______________________________________________
> syslog-ng maillist  -  syslog-ng@lists.balabit.hu
> https://lists.balabit.hu/mailman/listinfo/syslog-ng

-- 
Andrew Dixon
Software Engineer
Seranoa Networks
978.897.3434 x231