[dovecot-cvs] dovecot/src/lib-imap imap-parser.c,1.38,1.39

cras at procontrol.fi cras at procontrol.fi
Fri Feb 14 10:00:04 EET 2003


Update of /home/cvs/dovecot/src/lib-imap
In directory danu:/tmp/cvs-serv25776/lib-imap

Modified Files:
	imap-parser.c 
Log Message:
Complain if atoms contain invalid characters.



Index: imap-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-parser.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- imap-parser.c	8 Feb 2003 10:44:01 -0000	1.38
+++ imap-parser.c	14 Feb 2003 08:00:01 -0000	1.39
@@ -9,6 +9,11 @@
 #define is_linebreak(c) \
 	((c) == '\r' || (c) == '\n')
 
+#define IS_ATOM_SPECIAL(c) \
+	((c) == '(' || (c) == ')' || (c) == '{' || \
+	 (c) == '*' || (c) == '%' || (c) == '"' || (c) == '\\' || \
+	 (c) <= 32 || (c) == 0x7f)
+
 #define LIST_ALLOC_SIZE 7
 
 enum arg_parse_type {
@@ -281,6 +286,12 @@
 				 is_linebreak(data[i])) {
 				imap_parser_save_arg(parser, data, i);
 				break;
+			} else if (IS_ATOM_SPECIAL(data[i])) {
+				parser->error = "Invalid characters in atom";
+				return FALSE;
+			} else if ((data[i] & 0x80) != 0) {
+				parser->error = "8bit data in atom";
+				return FALSE;
 			}
 		}
 	}




More information about the dovecot-cvs mailing list