Another VirtualPath-type bug

Katsuhiro Kondou kondou at nec.co.jp
Wed Jun 21 22:23:13 UTC 2000


In article <Pine.BSF.3.96.1000621220810.302C-100000 at marley.vszbr.cz>,
	Just Another Victim of the Danish Usenet Afrydder-Mafia <barry at marley.mendelu.cz> wrote;

} This is to fix a bug which I found the day before, which didn't
} seem to make it to this list (I'm reading by news and only now
} has this article shown up), in which command `BODY' with a
} virtual host defined returned nothing to the expectant victim.

I see.

} I haven't done much research on the problem `path' that I am
} now reporting, but the articles where I do notice it are in CNFS
} buffers, and often I see the entire article from the start of the
} contents of the Path: header past the end and overlapping the
} overwritten article in the buffer.

I think I've got the problem and attached should work.

} I see more problems now, concerning the spool filling up and
} throttling in a weird way, but I'm not anywhere that I can make
} a useful report on just what's happening there at the moment.

Ok, we wait for your report.
-- 
Katsuhiro Kondou

--- nnrpd/article.c.orig	Mon Jun 12 10:27:24 2000
+++ nnrpd/article.c	Thu Jun 22 07:14:02 2000
@@ -416,7 +416,7 @@
 	}
     }
 
-    if (VirtualPathlen > 0) {
+    if (VirtualPathlen > 0 && (what != STbody)) {
 	if ((path = (char *)HeaderFindMem(ARThandle->data, ARThandle->len, "path", sizeof("path") - 1)) == NULL) {
 	    SendIOv(".\r\n", 3);
 	    ARTgetsize += 3;
@@ -458,9 +458,14 @@
 		return;
 	    }
 	}
-	virtualpath = NEW(char, VirtualPathlen + 1);
+	virtualpath = NEW(char, VirtualPathlen + 2);
 	sprintf(virtualpath, "!%s", VirtualPath);
-	if ((s = strstr(path, virtualpath)) != NULL) {
+	for (s = path ; s + VirtualPathlen + 1 < ARThandle->data + ARThandle->len ; s++) {
+	    if (*s != *virtualpath || !EQn(s, virtualpath, VirtualPathlen + 1))
+		continue;
+	    break;
+	}
+	if (s + VirtualPathlen + 1 < ARThandle->data + ARThandle->len) {
 	    if (xref > path) {
 	        SendIOv(q, path - q);
 	        SendIOv(s + 1, xref - (s + 1));
@@ -561,7 +566,12 @@
 		if (pathheader && (VirtualPathlen > 0)) {
 		    virtualpath = NEW(char, VirtualPathlen + 1);
 		    sprintf(virtualpath, "!%s", VirtualPath);
-		    if ((s = strstr(p, virtualpath)) != NULL) {
+		    for (s = p ; s + VirtualPathlen + 1 < ARThandle->data + ARThandle->len ; s++) {
+			if (*s != *virtualpath || !EQn(s, virtualpath, VirtualPathlen + 1))
+			    continue;
+			break;
+		    }
+		    if (s + VirtualPathlen + 1 < ARThandle->data + ARThandle->len) {
 			memcpy(retval, s + 1, q - (s + 1));
 		    } else {
 			memcpy(retval, VirtualPath, VirtualPathlen);



More information about the inn-workers mailing list