From 0cf7bfa04aff5db43a0110514e37c67d438a4b40 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Tue, 13 Jun 2017 19:46:48 +0000 Subject: [PATCH] parser: remove isHexNumber() function Signed-off-by: Janos SUTO --- src/parser.c | 6 ++++-- src/parser.h | 1 - src/parser_utils.c | 10 ---------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/parser.c b/src/parser.c index 12b0976a..c11c1488 100644 --- a/src/parser.c +++ b/src/parser.c @@ -699,8 +699,10 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata len = strlen(puf); - if(state->is_header == 0 && strncmp(puf, "__URL__", 7) && (puf[0] == ' ' || (len > MAX_WORD_LEN && cfg->enable_cjk == 0) || isHexNumber(puf)) ) continue; - + // skip body tokens if not an URL && (empty token || too long) + if(state->is_header == 0 && strncmp(puf, "__URL__", 7) && (puf[0] == ' ' || (len > MAX_WORD_LEN && cfg->enable_cjk == 0)) ){ + continue; + } if(state->message_state == MSG_FROM && state->is_1st_header == 1 && strlen(state->b_from) < SMALLBUFSIZE-len-1){ strtolower(puf); diff --git a/src/parser.h b/src/parser.h index c6a9bbed..f448d6f9 100644 --- a/src/parser.h +++ b/src/parser.h @@ -15,7 +15,6 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata void init_state(struct parser_state *state); time_t parse_date_header(char *s); -int isHexNumber(char *p); int extract_boundary(char *p, struct parser_state *state); void fixupEncodedHeaderLine(char *buf, int buflen); void fixupSoftBreakInQuotedPritableLine(char *buf, struct parser_state *state); diff --git a/src/parser_utils.c b/src/parser_utils.c index 71ad3b60..51476691 100644 --- a/src/parser_utils.c +++ b/src/parser_utils.c @@ -261,16 +261,6 @@ time_t parse_date_header(char *datestr){ } -int isHexNumber(char *p){ - for(; *p; p++){ - if(!(*p == '-' || (*p >= 0x30 && *p <= 0x39) || (*p >= 0x41 && *p <= 0x46) || (*p >= 0x61 && *p <= 0x66)) ) - return 0; - } - - return 1; -} - - int extract_boundary(char *p, struct parser_state *state){ char *q, *q2;