changeset 22156:b37395fd83cd

lib-mail: parse_addr_spec: Email address without local-part is invalid Add explicit invalid_syntax flag also when end of input occure because address is without domain invalid and in this case it was not correctly propagated.
author Pali Rohár <pali.rohar@gmail.com>
date Sun, 05 Jun 2016 15:48:17 +0200
parents fe6b566d6f1c
children 19734488e58a
files src/lib-mail/message-address.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-mail/message-address.c	Sun Jun 05 15:48:16 2016 +0200
+++ b/src/lib-mail/message-address.c	Sun Jun 05 15:48:17 2016 +0200
@@ -162,6 +162,10 @@
 		str_truncate(ctx->parser.last_comment, 0);
 
 	ret = parse_local_part(ctx);
+	if (ret <= 0) {
+		/* end of input or parsing local-part failed */
+		ctx->addr.invalid_syntax = TRUE;
+	}
 	if (ret != 0 && *ctx->parser.data == '@') {
 		ret2 = parse_domain(ctx);
 		if (ret2 <= 0)