fixed bug #677841 by limiting the scanner to no more than 4095 characters for a single ID token

This commit is contained in:
Ed Beroset 2003-09-08 00:30:40 +00:00
parent 9aea715998
commit c06f6df292
3 changed files with 9 additions and 2 deletions

View File

@ -38,6 +38,9 @@
#define BOGUS_VALUE -4
#define PERMTS_SIZE 4096 /* size of text blocks */
#if (PERMTS_SIZE > IDLEN_MAX)
#error "IPERMTS_SIZE must be less than or equal to IDLEN_MAX"
#endif
/* values for label.defn.is_global */
#define DEFINED_BIT 1

2
nasm.h
View File

@ -40,7 +40,7 @@
#define POSTFIX_MAX 10
#endif
#define IDLEN_MAX 4096
/*
* Name pollution problems: <time.h> on Digital UNIX pulls in some

View File

@ -727,8 +727,12 @@ int stdscan (void *private_data, struct tokenval *tv)
}
r = stdscan_bufptr++;
/* read the entire buffer to advance the buffer pointer but... */
while (isidchar(*stdscan_bufptr)) stdscan_bufptr++;
tv->t_charptr = stdscan_copy(r, stdscan_bufptr - r);
/* ... copy only up to IDLEN_MAX-1 characters */
tv->t_charptr = stdscan_copy(r, stdscan_bufptr - r < IDLEN_MAX ?
stdscan_bufptr - r : IDLEN_MAX - 1);
if (is_sym || stdscan_bufptr-r > MAX_KEYWORD)
return tv->t_type = TOKEN_ID;/* bypass all other checks */