dovecot-1.1: rfc822_parse_[dot_]atom(): Return failure if there ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 7 19:43:56 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/5d8aa306ca0e
changeset: 7859:5d8aa306ca0e
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 07 19:43:53 2008 +0300
description:
rfc822_parse_[dot_]atom(): Return failure if there isn't at least one character.

diffstat:

1 file changed, 8 insertions(+), 2 deletions(-)
src/lib-mail/rfc822-parser.c |   10 ++++++++--

diffs (27 lines):

diff -r 2dc27d949b6d -r 5d8aa306ca0e src/lib-mail/rfc822-parser.c
--- a/src/lib-mail/rfc822-parser.c	Sun Sep 07 19:25:10 2008 +0300
+++ b/src/lib-mail/rfc822-parser.c	Sun Sep 07 19:43:53 2008 +0300
@@ -132,7 +132,10 @@ int rfc822_parse_atom(struct rfc822_pars
 	   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 @@ int rfc822_parse_dot_atom(struct rfc822_
 
 	   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;
 


More information about the dovecot-cvs mailing list