xover patch (again)

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

 



Hi:
	Hours after I posted the previous xover.c patch I was
hit by a core dump from nntpcached.  It turned out that the problem
that I set out to fix was not restricted to that particular line.
Here's is a second attempt at fixing it.

Note that I now reset outbuf_used in xf_release_writer, is this
the correct thing to do??
-- 
Debian GNU/Linux 1.1 is out! { http://www.debian.org/ }
Email:  Herbert Xu ~{PmV>HI~} <herbert@greathan.apana.org.au>
{ http://greathan.apana.org.au/~herbert/ }
PGP Key:  pgp-public-keys@pgp.mit.edu or any other key sites
--
--- ../nntpcache-current.orig/xover.c	Thu Sep  5 01:02:07 1996
+++ xover.c	Sun Sep 29 21:21:03 1996
@@ -315,6 +315,7 @@
 	{
 		free (xf->outbuf);
                 xf->outbuf = NULL;
+		xf->outbuf_used = 0;
         }
 	if (xf->locked)
 	{
@@ -602,7 +603,25 @@
 		 * set failed flag in index for xover region asked.
 		 * we then knock em out one by one as xovers come in
 		 */
-		memset (xf->buf+((min%MI)*4), 0xff, ((max>MI)? MI*4: (max%MI)*4)-((min%MI)*4));
+		if (min / MI == t)
+		{
+			if (min % MI + (max - min) >= MI)
+				memset (xf->buf+((min%MI)*4), 0xff, (MI-(min%MI))*4);
+			else
+				memset (xf->buf+((min%MI)*4), 0xff, (max-min+1)*4);
+		}
+		else
+		{
+			/*
+			 * assert(response % MI == 0);
+			 * we dont assume that here for safety
+			 * reasons.
+			 */
+			if (response % MI + (max - response) >= MI)
+				memset(xf->buf+((response%MI)*4), 0xff, (MI-(response%MI))*4);
+			else
+				memset(xf->buf+((response%MI)*4), 0xff, (max-response+1)*4);
+		}
 	} else
 	{
 		if (!xf->locked) /* size can't change if we have locked it */


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux