cvs commit: src/include ctype.h src/lib/libc/gen isctype.c tolower.c toupper.c

Jeroen Ruigrok/asmodai asmodai at in-nomine.org
Thu Jul 7 01:39:45 PDT 2005


-On [20050707 09:20], Matthew Dillon (dillon at xxxxxxxxxxxxxxxxxxxxxxx) wrote:
>  Modified files:
>    include              ctype.h 
>    lib/libc/gen         isctype.c tolower.c toupper.c 
>  Log:
>  It is not acceptable to index the array out of bounds if an illegal index
>  is passed to a ctype function or macro.  Undo the last commit.  Emplace an
>  explicit range check for the integer passed to the ctype macros and
>  functions rather then underflowing or overflowing the array.  Currently
>  return 0 if the integer is out of range (it might be more appropriate to
>  assert).

#define _CTYPE_NUM_CHARS        (1 << (8*sizeof(char)))

This is unneeded hackery.  Why not pull in limits.h instead and use
UCHAR_MAX?

-- 
Jeroen Ruigrok van der Werven <asmodai(at)wxs.nl> / asmodai / kita no mono
Free Tibet! http://www.savetibet.org/ | http://ashemedai.deviantart.com/
http://www.tendra.org/   | http://www.in-nomine.org/
The riddle master himself lost the key to his own riddles one day, and
found it again at the bottom of his heart.





More information about the Commits mailing list