Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ignore tokens larger than 50 characters

  • Loading branch information...
commit 989db2ca5948c3694a5dfbda71aa7589135ccd3a 1 parent f6a49d0
@wmorgan authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 entry.c
View
12 entry.c
@@ -67,14 +67,16 @@ uint32_t wp_entry_size(wp_entry* entry) {
return ret;
}
+#define MAX_TOKEN_LENGTH 50
+
RAISING_STATIC(add_from_lexer(wp_entry* entry, yyscan_t* scanner, const char* field)) {
- int token_type;
size_t field_len = strlen(field);
- do {
- token_type = yylex(*scanner);
- RELAY_ERROR(add_token(entry, field, yyget_text(*scanner), field_len, yyget_leng(*scanner)));
- } while(token_type != TOK_DONE);
+ while(yylex(*scanner) != TOK_DONE) {
+ if(yyget_leng(*scanner) <= MAX_TOKEN_LENGTH) {
+ RELAY_ERROR(add_token(entry, field, yyget_text(*scanner), field_len, yyget_leng(*scanner)));
+ }
+ }
return NO_ERROR;
}
Please sign in to comment.
Something went wrong with that request. Please try again.