summaryrefslogtreecommitdiff
path: root/nasmlib.c
diff options
context:
space:
mode:
authorEd Beroset <beroset@mindspring.com>2003-09-08 00:30:40 +0000
committerEd Beroset <beroset@mindspring.com>2003-09-08 00:30:40 +0000
commitc06f6df2922f47309f9ff99fd8f07c37bd053a44 (patch)
tree0b30d094e069560154b2e06e757933a57f8896af /nasmlib.c
parent9aea71599801dfc53e7e29da4bbdb46d01c86144 (diff)
downloadnasm-c06f6df2922f47309f9ff99fd8f07c37bd053a44.tar.gz
nasm-c06f6df2922f47309f9ff99fd8f07c37bd053a44.tar.bz2
nasm-c06f6df2922f47309f9ff99fd8f07c37bd053a44.zip
fixed bug #677841 by limiting the scanner to no more than 4095 characters for a single ID token
Diffstat (limited to 'nasmlib.c')
-rw-r--r--nasmlib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/nasmlib.c b/nasmlib.c
index 7578ea7..e63b573 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -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 */