[Gllug] C function strcasecmp

David Spencer David.W.Spencer at oracle.com
Fri Jul 20 15:03:12 UTC 2001


strn(anything) doesn't protect you from buffer overflows; by the time
you're comparing text you've usually already read the text into the
buffer that's just overflowed.  Checking the size of text in the edit
box (or whatever) _before_ reading the text into an appropriately sized
buffer is what protects you from buffer overflows.

Dave.


tet at accucard.com wrote:
> 
> >thus I want to use the strcasecmp() function.
> >
> >OK: Linux has it, BSD 4.4 has it (the manual says), but how portable is it ?
> >Sun, HP, AIX I suppose are the most important.
> 
> 1. Use strncasecmp() to prevent against buffer overflows
> 2. It's defined as manadatory in the Unix95, Unix98 and XSI standards,
>    so I'd expect it to be pretty prevalent among Unix variants. I can
>    vouch for its existence on Solaris, OpenBSD and DG/UX, and if my
>    fscking Belkin Omniview Pro KVM switch was working, I could check
>    Tru64 for you. As it isn't, I'm not going to go to the effort of
>    unplugging my monitor cables (the machine isn't yet on the network).
> 
> Tet
> 
> --
> Gllug mailing list  -  Gllug at linux.co.uk
> http://list.ftech.net/mailman/listinfo/gllug

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list