8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:03:03 +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++; token += *s++;
} }
*stmt = s; *stmt = s;
/* CVC: Will adjust this check. if (token.length() > MAX_TOKEN_SIZE) {
if (p >= token_end) {
// '=' used as then there is no place for null termination // '=' used as then there is no place for null termination
token.erase(MAX_TOKEN_SIZE);
*token_length = MAX_TOKEN_SIZE;
token[MAX_TOKEN_SIZE] = '\0';
return TOKEN_TOO_LONG; return TOKEN_TOO_LONG;
} }
*/
return STRING; return STRING;
} }
@ -422,14 +418,10 @@ static SSHORT get_next_token(
for (; s < stmt_end && (classes[c = *s] & CHR_DIGIT); ++s); // empty body for (; s < stmt_end && (classes[c = *s] & CHR_DIGIT); ++s); // empty body
const ptrdiff_t length = (s - start_of_token); const ptrdiff_t length = (s - start_of_token);
*stmt = s; *stmt = s;
/* CVC: Will adjust this check.
if (length > MAX_TOKEN_SIZE) { if (length > MAX_TOKEN_SIZE) {
memcpy(token, start_of_token, MAX_TOKEN_SIZE); token.assign(start_of_token, MAX_TOKEN_SIZE);
token[MAX_TOKEN_SIZE] = '\0';
*token_length = MAX_TOKEN_SIZE;
return TOKEN_TOO_LONG; return TOKEN_TOO_LONG;
} }
*/
token.assign(start_of_token, length); token.assign(start_of_token, length);
return NUMERIC; return NUMERIC;
} }
@ -443,13 +435,10 @@ static SSHORT get_next_token(
} }
*stmt = s; *stmt = s;
/* CVC: Will adjust this check. if (token.length() > MAX_TOKEN_SIZE) {
if (p >= token_end) { token.erase(MAX_TOKEN_SIZE);
*token_length = MAX_TOKEN_SIZE;
token[MAX_TOKEN_SIZE] = '\0';
return TOKEN_TOO_LONG; return TOKEN_TOO_LONG;
} }
*/
return SYMBOL; return SYMBOL;
} }