[evolution-patches] patch review for crash bug



Hi, there,

Here's a small patch to fix a crash bug.
If you create vfolder like "xxx%%$$" it'll crash  on solaris or
mis-displayed.
Suppose we shouldn't decode for all "%xx" case, the "x" here should be
{digital|a~z|A~z}.

Thanks.
Calvin
Index: camel-url.c
===================================================================
RCS file: /export/src/cvs/evolution/camel/camel-url.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 camel-url.c
--- camel-url.c	2003/09/26 06:34:29	1.1.1.1
+++ camel-url.c	2003/12/01 11:21:06
@@ -504,8 +504,17 @@
 	s = d = (unsigned char *)part;
 	do {
 		if (*s == '%' && s[1] && s[2]) {
-			*d++ = (XDIGIT (s[1]) << 4) + XDIGIT (s[2]);
-			s += 2;
+			if (((s[1] >= 48 && s[1] <= 57) 
+				|| (s[1] >= 65 && s[1] <= 70) 
+				|| (s[1] >= 97 && s[1] <= 102))
+				&&
+				((s[2] >= 48 && s[2] <= 57) 
+				|| (s[2] >= 65 && s[2] <= 70) 
+				|| (s[2] >= 97 && s[2] <= 102))){
+				*d++ = (XDIGIT (s[1]) << 4) + XDIGIT (s[2]);
+				s += 2;
+			} else
+				*d++ = *s;
 		} else
 			*d++ = *s;
 	} while (*s++);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]