squidGuard's great, it's serving us very well. However, there seems to be a problem with the handling of URI encoded characters. From my tests, any URI encoded characters other than whitespace and newlines are discarded by the line parsing code.

I enclose a patch which, on my system, appears to fix the bug. If anyone has suggestions or comments, I'd appreciate them!

Apologies if this appears twice; my mail client died whilst sending it last time.

Regards,
Greg Sheard
Technical Director
ECSC Ltd.
www.ecsc.co.uk
diff -urN -x config.h -x sg.h -x Makefile squidGuard-1.2.0-orig/src/sgDiv.c squidGuard-1.2.0/src/sgDiv.c
--- squidGuard-1.2.0-orig/src/sgDiv.c	Tue May 15 09:01:37 2001
+++ squidGuard-1.2.0/src/sgDiv.c	Mon May 20 16:16:53 2002
@@ -126,16 +126,15 @@
         hex = h1 >= 'A' ? h1 - 'A' - 10 : h1 - '0';
         hex *= 16;
         hex += h2 >= 'A' ? h2 - 'A' - 10 : h2 - '0';
-	/* don't convert whitespace, newline and carriage return */
-	if(hex == 0x20 || hex == 0x09 || hex == 0x0a || hex == 0x0d){
+	/* pass through anything except 0x0 */
+	if(hex == 0x0)
+	  i+=2;
+	else {
 	  *upp++ = up[i++];
 	  *upp++ = up[i++];
 	  *upp++ = up[i];
-	} else { 
-	  *upp++ = hex;
-	  i+=2;
 	}
-      } else { /* an errorous hex code, we ignore it */
+      } else { /* an badly encoded character, pass it on */
         *upp++ = up[i++];
         *upp++ = up[i++];
         *upp++ = up[i];


Reply via email to