Browse code

fixes SER-322: - parser sticks in an endless loop when the terminating quote mark is missing in a substring: @hf_value["Contact].uri - quote mark can be escaped: @hf_value[\"Contact\"].uri

Miklos Tirpak authored on 15/10/2007 07:55:41
Showing 1 changed files
... ...
@@ -92,11 +92,17 @@ int w_parse_select(char**p, select_t* sel)
92 92
 		sel->n++;
93 93
 		if (*(*p)=='[') {
94 94
 			(*p)++; 
95
+			if (*(*p)=='\\') (*p)++;
95 96
 			if (*(*p)=='"') {
96 97
 				(*p)++;	
97 98
 				name.s=(*p);
98
-				while (*(*p)!='"') (*p)++;
99
+				while ((*(*p)!='\0') && (*(*p)!='"')) (*p)++;
100
+				if (*(*p)!='"') {
101
+					ERR("parse_select: end of string is missing\n");
102
+					goto error;
103
+				}
99 104
 				name.len=(*p)-name.s;
105
+				if (*((*p)-1)=='\\') name.len--;
100 106
 				(*p)++;
101 107
 				if (*(*p)!=']') {
102 108
 					ERR("parse_select: invalid string index, no closing ]\n");