Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8168:55871f3b4481 HEAD
rfc822_parse_[dot_]atom(): Return failure if there isn't at least one character.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 07 Sep 2008 19:44:09 +0300 |
parents | 99704b6b8dde |
children | cb01142bb9e8 |
files | src/lib-mail/rfc822-parser.c |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-mail/rfc822-parser.c Sun Sep 07 19:25:29 2008 +0300 +++ b/src/lib-mail/rfc822-parser.c Sun Sep 07 19:44:09 2008 +0300 @@ -132,7 +132,10 @@ atext = ; Any character except controls, SP, and specials. */ - for (start = ctx->data; ctx->data != ctx->end; ctx->data++) { + if (ctx->data == ctx->end || !IS_ATEXT(*ctx->data)) + return -1; + + for (start = ctx->data++; ctx->data != ctx->end; ctx->data++) { if (IS_ATEXT(*ctx->data)) continue; @@ -158,7 +161,10 @@ For RFC-822 compatibility allow LWSP around '.' */ - for (start = ctx->data; ctx->data != ctx->end; ctx->data++) { + if (ctx->data == ctx->end || !IS_ATEXT(*ctx->data)) + return -1; + + for (start = ctx->data++; ctx->data != ctx->end; ctx->data++) { if (IS_ATEXT(*ctx->data)) continue;