🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
4 messages
4 total messages Started by Dan Harkless Thu, 12 Feb 1998 00:00
Patch: trn seg faults on newsgroup names > 127 chars
#38663
Author: Dan Harkless
Date: Thu, 12 Feb 1998 00:00
93 lines
4327 bytes
Howdy.  For the last few weeks, trn4-test60 has been seg faulting on me,
right after it lists the first few newsgroups with unread news:

    Connecting to news.speed.net...Done.
    Unread news in a.bsu.programming                          661 articles
    Unread news in a.bsu.religion                              86 articles
    Unread news in a.bsu.talk                                  56 articles
    Unread news in aaa.inu-chan                                 5 articles
    Unread news in ab.general                                  86 articles
    etc.

    Caught a SIGSEGV--.newsrc restored
    Abort

trn 3.6 does the same thing.  I tried installing the latest, trn4-test61,
but it behaved the same way.  I tried configuring not to use vfork(), since
Configure says "some systems" have problems with it.  Didn't help.  Tried
compiling with gcc instead of HP-UX 10.20 cc.  No dice.

Finally, I compiled test61 with debug support.  Running with -D didn't
uncover anything useful, so finally I ran trn in the debugger.  There I
found that it was seg faulting on line 231 of the hash() function:

     230:     while (keylen--)
 >   231:         hash += *key++;

This is because it was called with keylen == -97.  It ran amok through
memory until keylen got to -102866 and then seg faulted.

I ran up the call stack and traced the computation of keylen to the
parse_rcline() function, called just before hashfetch().  Here we find the
very surprising line 690.

     669: static void
     670: parse_rcline(np)
     671: register NGDATA* np;
     672: {
     673:     char* s;
     674:     int len;
     675: 
     676:     for (s=np->rcline; *s && *s!=':' && *s!=NEGCHAR && !isspace(*s); s++) ;
     677:     len = s - np->rcline;
     678:     if ((!*s || isspace(*s)) && !checkflag) {
     679: #ifndef lint
     680:         np->rcline = saferealloc(np->rcline,(MEM_SIZE)len + 3);
     681: #endif
     682:         s = np->rcline + len;
     683:         strcpy(s, ": ");
     684:     }
     685:     if (*s == ':' && s[1] && s[2] == '0') {
     686:         np->flags |= NF_UNTHREADED;
     687:         s[2] = '1';
     688:     }
     689:     np->subscribechar = *s;             /* salt away the : or ! */
 >   690:     np->numoffset = (char)len + 1;
     691:                                 /* remember where the numbers are */
     692:     *s = '\0';                  /* null terminate newsgroup name */
     693: }

'len' is an int.  'np->numoffset' is an int.  But for some reason for the
duration of the expression, we pretend we're dealing with 7 bit signed
values.  Why?!?

My news server is carrying a newsgroup called:

    alt.karl-kleinpaste.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die

The len is 159, but then we cast to a char for some reason, overflow, and
get -96.  If the cast is removed:

    moldavia-root> diff rcstuff.c.orig rcstuff.c
    690c690
    <     np->numoffset = (char)len + 1;
    ---
    >     np->numoffset = len + 1;

Everything works great, as expected.

So, the two questions become:

1. Why the heck was that data-chopping cast in there?
2. Am I really the only person in the world using trn whose news server
   carries a group with a name longer than 127 characters???

--
Dan Harkless          Unitech Research, Inc.         <dan_feb98@unitech.com>

NOTE:  This is a monthly mail alias used to post to the Usenet without
conSPAMinating my real address.  If you are replying after February 1998,
your mail may bounce.  If so, replace 'feb' with the current month's abbrev.

Re: Patch: trn seg faults on newsgroup names > 127 chars
#38644
Author: Kevin Martin
Date: Thu, 12 Feb 1998 00:00
23 lines
1452 bytes
In article <6bttmf$cer$1@speedx1.speed.net>, it says Dan Harkless <dan_feb98@unitech.com> wrote:

?  My news server is carrying a newsgroup called:
?   alt.karl-kleinpaste.die.die.die.die.die.die.die.die.die.die.die.die.die.die.
?  die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.d
?  ie.die

What the fsck--?!

?  So, the two questions become:
?  1. Why the heck was that data-chopping cast in there?
?  2. Am I really the only person in the world using trn whose news server
?     carries a group with a name longer than 127 characters???

No, three questions:
   3. What newsadmin would newgroup a piece of dreck like that, and why
      on earth should any newsreader FAIL to barf it out?

Sometimes vomiting and diarrhea are proper and natural, i.e. your active 
file clearly has swallowed something it shouldn't have.

Re: Patch: trn seg faults on newsgroup names > 127 chars
#38662
Author: Dan Harkless
Date: Thu, 12 Feb 1998 00:00
33 lines
1987 bytes
In article <6bttmf$cer$1@speedx1.speed.net>, I wrote:
> >   690:     np->numoffset = (char)len + 1;
>     691:                                 /* remember where the numbers are */
>     692:     *s = '\0';                  /* null terminate newsgroup name */
>     693: }
>
>'len' is an int.  'np->numoffset' is an int.  But for some reason for the
>duration of the expression, we pretend we're dealing with 7 bit signed
>values.  Why?!?

To answer my own question:  

I dug out the trn 3.6 source and I see that we didn't used to assign to
np->numoffset.  We instead assigned to an element of an array of char.  So I
guess trn 3.6 users are just out of luck if their server carries long group
names like:

>alt.karl-kleinpaste.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die

My patch won't help them -- I recommend they upgrade to trn4 (currently in
beta).  Check out:

    http://www.clari.net/~wayne/

--
Dan Harkless          Unitech Research, Inc.         <dan_feb98@unitech.com>

NOTE:  This is a monthly mail alias used to post to the Usenet without
conSPAMinating my real address.  If you are replying after February 1998,
your mail may bounce.  If so, replace 'feb' with the current month's abbrev.

Re: Patch: trn seg faults on newsgroup names > 127 chars
#38667
Author: Karl Kleinpaste
Date: Thu, 12 Feb 1998 00:00
36 lines
3051 bytes
Dan Harkless <dan_feb98@unitech.com> wrote:
>>  My news server is carrying a newsgroup called:
>>   alt.karl-kleinpaste.die.die.die.die.die.die.die.die.die.die.die.die.die.die.
>>  die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.die.d
>>  ie.die

brasscannon@bigfoot.com (Kevin Martin) writes:
>    3. What newsadmin would newgroup a piece of dreck like that...

Last October, a certain Jeffery D. Hunt decided that alt.* was his
personal playground, and that this was by design, such that he started
newgroup'ing a whole lot of stupid groups, f'rinstance...

alt.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.qa.a.a.a.a.a
alt.aye.yeay.yay.yo.iu.yt.re.fsd.gsg.jjghjj.fbwergblek.989.1.2.3.4.5.6.7.8.9.10.11.12.1.3.33.4.44.55.66.7.7778.66.uuu.tt.567554.ttututrurutrhjcvnvcn.5654.g.f.dsd.fggh.feer.dffvhj.ytyvb.rsdafdg.ffbhhdth.hasta.la.vista
alt.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666.666

...among many others.  A day or two into these antics, and someone
dubbed him "the newest Mad Newgrouper."  I decided to tell Mr. Hunt
what I thought of him, and I also got in touch with the folks at
sympatico.ca regarding his activities.  Mr. Hunt threatened (I guess
that's what you'd call it) to tell my "boss" (I haven't got one, in a
technical sense) and to get my newsadmin on my case.  He neglected to
observe that I am my own newsadmin, he wasn't aware that my nearest
approximation of a boss supports anything I do with news here, and the
fine folks running sympatico.ca pleasantly beat Mr. Hunt off their
systems...but not before he decided he'd express his opinion of me in
the only way he knows how.

A properly configured control.ctl would have kept either group from
instantiating.

Please rmgroup all these groups.

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads