aboutsummaryrefslogtreecommitdiffstats
path: root/src/ragel/smtp_date_parser.rl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ragel/smtp_date_parser.rl')
-rw-r--r--src/ragel/smtp_date_parser.rl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ragel/smtp_date_parser.rl b/src/ragel/smtp_date_parser.rl
index 48a1cbcbf..d53e61148 100644
--- a/src/ragel/smtp_date_parser.rl
+++ b/src/ragel/smtp_date_parser.rl
@@ -1,6 +1,7 @@
%%{
machine smtp_date_parser;
+ alphtype unsigned char;
include smtp_base "smtp_base.rl";
include smtp_date "smtp_date.rl";
@@ -13,9 +14,9 @@
%% write data;
guint64
-rspamd_parse_smtp_date (const char *data, size_t len, GError **err)
+rspamd_parse_smtp_date (const unsigned char *data, size_t len, GError **err)
{
- const gchar *p = data, *pe = data + len, *eof = data + len, *tmp = data;
+ const unsigned char *p = data, *pe = data + len, *eof = data + len, *tmp = data;
struct tm tm;
glong tz = 0;
gint cs = 0;
@@ -27,7 +28,7 @@ rspamd_parse_smtp_date (const char *data, size_t len, GError **err)
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);
+ (int)(p - data), (*p > 0 && *p < 128) ? *p : '?', cs);
return (guint64)(-1);
}