Subject: Re: lib/19638: isalpha (3) bug
To: Mike Cheponis <mac@Wireless.Com>
From: Dave Sainty <dave@dtsp.co.nz>
List: netbsd-bugs
Date: 01/03/2003 15:37:35
Mike Cheponis writes:

> Thanks for rapid response!
> 
> 
> Interesting.  Here is my man page:

Ah, it must have been updated at some stage more recently.

> Still, it seems a gross bug to take an "int" argument and then segfault
> when the routine sees an argument it doesn't like.
> 
> It's not the "NetBSD Way".

It might help to know how it's implemented.  These functions all
reference directly into an array in memory, sized to handle the range
-1 .. 255.  So it isn't a coding error in isalpha() that causes it to
seg fault, it simply relies on the calling program to ensure that the
argument will not fall off the top or the bottom of the array.

Usually the input stream is 8-bit anyway, so in typical code (so long
as the value is correctly cast as unsigned), it's impossible to exceed
the acceptable range anyway.

Cheers,

Dave