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

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 7 19:44:13 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/55871f3b4481
changeset: 8168:55871f3b4481
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 07 19:44:09 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 99704b6b8dde -r 55871f3b4481 src/lib-mail/rfc822-parser.c
--- 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 @@ 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