8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:43:04 +01:00

Restore checks for length. We don't need tokens bigger than 1KB.

This commit is contained in:
robocop 2004-12-12 01:57:19 +00:00
parent 0a379247c3
commit 5291dc6544

View File

@ -404,15 +404,11 @@ static SSHORT get_next_token(
token += *s++;
}
*stmt = s;
/* CVC: Will adjust this check.
if (p >= token_end) {
if (token.length() > MAX_TOKEN_SIZE) {
// '=' used as then there is no place for null termination
*token_length = MAX_TOKEN_SIZE;
token[MAX_TOKEN_SIZE] = '\0';
token.erase(MAX_TOKEN_SIZE);
return TOKEN_TOO_LONG;
}
*/
return STRING;
}
@ -422,14 +418,10 @@ static SSHORT get_next_token(
for (; s < stmt_end && (classes[c = *s] & CHR_DIGIT); ++s); // empty body
const ptrdiff_t length = (s - start_of_token);
*stmt = s;
/* CVC: Will adjust this check.
if (length > MAX_TOKEN_SIZE) {
memcpy(token, start_of_token, MAX_TOKEN_SIZE);
token[MAX_TOKEN_SIZE] = '\0';
*token_length = MAX_TOKEN_SIZE;
token.assign(start_of_token, MAX_TOKEN_SIZE);
return TOKEN_TOO_LONG;
}
*/
token.assign(start_of_token, length);
return NUMERIC;
}
@ -443,13 +435,10 @@ static SSHORT get_next_token(
}
*stmt = s;
/* CVC: Will adjust this check.
if (p >= token_end) {
*token_length = MAX_TOKEN_SIZE;
token[MAX_TOKEN_SIZE] = '\0';
if (token.length() > MAX_TOKEN_SIZE) {
token.erase(MAX_TOKEN_SIZE);
return TOKEN_TOO_LONG;
}
*/
return SYMBOL;
}