aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-07-22 14:00:25 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:02:14 -0700
commit7601387b02d9798f54844858e932d2f3727811cd (patch)
treecc8683e706bccd888d40860e1e3e46e14a447340 /tokenize.c
parentDon't allow string concatenation to overflow MAX_STRING. (diff)
downloadsparse-7601387b02d9798f54844858e932d2f3727811cd.tar.gz
sparse-7601387b02d9798f54844858e932d2f3727811cd.tar.bz2
sparse-7601387b02d9798f54844858e932d2f3727811cd.zip
C99 says strings should be up to 4095 bytes.
Also, while we're here, be more careful about the exact limits, and concatenation: we want to have the ending NUL character even when we concatenate too much.
Diffstat (limited to 'tokenize.c')
-rw-r--r--tokenize.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tokenize.c b/tokenize.c
index 54f648e..d98a32a 100644
--- a/tokenize.c
+++ b/tokenize.c
@@ -550,7 +550,7 @@ static int get_string_token(int next, stream_t *stream)
len++;
}
- if (len >= MAX_STRING) {
+ if (len > MAX_STRING) {
warn(stream->pos, "string too long (%d bytes, %d bytes max)", len, MAX_STRING);
len = MAX_STRING;
}