potential ctype.h issues
A few things which might conceivably pass negative values to ctype routines. Some are post-3.6.0. None of them explain the sporadic Windows assertion failure. Using tolower() without verifying the argument isupper() should be completely safe when tolower() is a function but might not be when it's a macro. (Likewise for toupper() without islower().) NetHack's lowc() function is always safe, at least for ASCII.
This commit is contained in:
@@ -1468,7 +1468,7 @@ rndmonst()
|
||||
rndmonst_state.mchoices[mndx] = 0;
|
||||
if (tooweak(mndx, minmlev) || toostrong(mndx, maxmlev))
|
||||
continue;
|
||||
if (upper && !isupper(def_monsyms[(int) (ptr->mlet)].sym))
|
||||
if (upper && !isupper((uchar) def_monsyms[(int) ptr->mlet].sym))
|
||||
continue;
|
||||
if (elemlevel && wrong_elem_type(ptr))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user