From c56bdc1cefc7de7b5c50b751aeafa9083aee18e3 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 2 May 2003 17:37:11 +0000 Subject: Workaround for POS mailers like the one in bug #42045. 2003-05-01 Jeffrey Stedfast Workaround for POS mailers like the one in bug #42045. * camel-mime-utils.c (header_decode_date): Make sure the numeric timezone is between -1200 and 1200, otherwise it is invalid. * broken-date-parser.c (get_tzone): Make sure the numeric timezone is between -1200 and 1200, otherwise it is invalid. svn path=/trunk/; revision=21048 --- camel/ChangeLog | 10 ++++++++++ camel/broken-date-parser.c | 6 +++++- camel/camel-mime-utils.c | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index bc5794ddc5..50d0a158de 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,13 @@ +2003-05-01 Jeffrey Stedfast + + Workaround for POS mailers like the one in bug #42045. + + * camel-mime-utils.c (header_decode_date): Make sure the numeric + timezone is between -1200 and 1200, otherwise it is invalid. + + * broken-date-parser.c (get_tzone): Make sure the numeric timezone + is between -1200 and 1200, otherwise it is invalid. + 2003-04-29 Dan Winship * Makefile.am (camel_lock_helper_SOURCES): Remove camel-lock.c diff --git a/camel/broken-date-parser.c b/camel/broken-date-parser.c index f6e697896c..7dcdf1e61e 100644 --- a/camel/broken-date-parser.c +++ b/camel/broken-date-parser.c @@ -291,7 +291,11 @@ get_tzone (struct _date_token **token) inend = inptr + inlen; if (*inptr == '+' || *inptr == '-') { - return decode_int (inptr, inlen); + t = decode_int (inptr, inlen); + if (t < -1200 || t > 1200) + return -1; + + return t; } else { if (*inptr == '(') { inptr++; diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 6ba498ffa9..907d61b5de 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -3506,9 +3506,13 @@ header_decode_date(const char *in, int *saveoffset) offset = (*inptr++)=='-'?-1:1; offset = offset * header_decode_int(&inptr); d(printf("abs signed offset = %d\n", offset)); + if (offset < -1200 || offset > 1200) + offset = 0; } else if (isdigit(*inptr)) { offset = header_decode_int(&inptr); d(printf("abs offset = %d\n", offset)); + if (offset < -1200 || offset > 1200) + offset = 0; } else { char *tz = decode_token(&inptr); -- cgit