Re: snnewgroup: Segmentation fault on ppc systems

Chris Niekel <[email protected]>
Newsgroups gmane.network.sn
Message-ID <[email protected]>
On Sun, Dec 07, 2003 at 08:36:44PM +0100, Sebastian D.B. Krause wrote:
> ,----[ gdb running snnewgroup ]
> | (gdb) set args gmane.network.sn news.gmane.org 119
> | (gdb) run
> | Starting program: /usr/sbin/snnewgroup gmane.network.sn news.gmane.org 119
> | 
> | Program received signal SIGSEGV, Segmentation fault.
> | 0x100015e8 in vachar (c=100, app=0x7ffffc08, tmp=0x7ffffbd8 "\017?\202X\020\001@\b\177?? \017???\017?~?", len=0x7ffffc0c)
> |     at format.c:59
> | 59	      case 'd': i = va_arg(*app, int); p = istr(i, 10, tmp); break;
> | (gdb) 

A debian-developer on IRC offered to help a bit, and noticed a lot of
"bad code" in sn. The va_start isn't always followed by a va_end, and
the manpage says:
      If ap is passed to a function that uses va_arg(ap,type) then the
      value of ap is undefined after the return of that function.

The code ignores this remark as well.  So it seems that sn is a bit
buggy in this regard, and the bug doesn't bite on intel, and it does
bite on ppc.

What needs to be changed in the code is that 
    1. All va_start need a va_end in the same function.
    2. The vachar function should be be inline relative to formatv. This
    can be achieved by turning vachar into a macro, or just moving the
    code.

I'll try to make those changes soon, and have them tested by the debian
developer and hopefully you. If it also works on my intel, I'll send the
patch to this list. 

Chris
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/1ZaggQ3S2XWlk0sRAlJnAJ94nMI2Z/4ShvTZO58eBwSAaHr+KACgo8g7
5ykYInvwqKhavctKfvrXxBY=
=P6cN
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.