diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-10-06 15:36:23 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-10-06 15:36:23 +0100 |
commit | b6085d45f1a31b4bf19abf91d5926e1ef87d39ca (patch) | |
tree | 87f2c55b9eb6a99e56eb4afeabd3aa49fc1c8b5c /src/ragel | |
parent | 83bcd4071050fa82deed1428cc587a1574b9c507 (diff) | |
download | rspamd-b6085d45f1a31b4bf19abf91d5926e1ef87d39ca.tar.gz rspamd-b6085d45f1a31b4bf19abf91d5926e1ef87d39ca.zip |
[Minor] Add erroring to smtp parse date
Diffstat (limited to 'src/ragel')
-rw-r--r-- | src/ragel/smtp_date_parser.rl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ragel/smtp_date_parser.rl b/src/ragel/smtp_date_parser.rl index f0d49c23a..48a1cbcbf 100644 --- a/src/ragel/smtp_date_parser.rl +++ b/src/ragel/smtp_date_parser.rl @@ -13,7 +13,7 @@ %% write data; guint64 -rspamd_parse_smtp_date (const char *data, size_t len) +rspamd_parse_smtp_date (const char *data, size_t len, GError **err) { const gchar *p = data, *pe = data + len, *eof = data + len, *tmp = data; struct tm tm; @@ -25,5 +25,11 @@ rspamd_parse_smtp_date (const char *data, size_t len) %% write init; %% write exec; + if ( cs < %%{ write first_final; }%% ) { + g_set_error (err, g_quark_from_static_string ("smtp_date"), cs, "invalid date at offset %d (%c), state %d", + p - data, *p, cs); + return (guint64)(-1); + } + return rspamd_tm_to_time (&tm, tz); }
\ No newline at end of file |