Merge pull request #12 from iamleot/cc_func-avoid-undefined-behaviour
Avoid undefined behaviour when using ctype(3) functions in relex() (possible fix for #11)
This commit is contained in:
commit
115fac0587
3
b.c
3
b.c
@ -27,6 +27,7 @@ THIS SOFTWARE.
|
||||
#define DEBUG
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -831,7 +832,7 @@ int relex(void) /* lexical analyzer for reparse */
|
||||
* not without first adapting the entire
|
||||
* program to track each string's length.
|
||||
*/
|
||||
for (i = 1; i < NCHARS; i++) {
|
||||
for (i = 1; i <= UCHAR_MAX; i++) {
|
||||
if (!adjbuf((char **) &buf, &bufsz, bp-buf+1, 100, (char **) &bp, "relex2"))
|
||||
FATAL("out of space for reg expr %.10s...", lastre);
|
||||
if (cc->cc_func(i)) {
|
||||
|
Loading…
Reference in New Issue
Block a user