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

Re: [leafnode-list] Re: boo hiss



On Thu, Jan 10, 2002 at 09:10:48AM +0100, Ralf Wildenhues wrote:
> I cannot reproduce the problem here, but it looks to me that a little
> before this, do_group does a sprintf(*s,..) to argument s, and I am not
> sure if it is big enough to hold the result.  Could someone check this
> please?

After some debugging with dmalloc, it looks like you were right on the
money with this.

I just tested the following patch and it ran through one download
successfully.  Woo!

patch -p1 << \EOF
diff -ru leafnode-2.0b8_ma9rc1.orig/fetchnews.c leafnode-2.0b8_ma9rc1/fetchnews.c
--- leafnode-2.0b8_ma9rc1.orig/fetchnews.c	Tue Jan  8 08:29:48 2002
+++ leafnode-2.0b8_ma9rc1/fetchnews.c	Thu Jan 10 14:52:40 2002
@@ -1287,7 +1287,9 @@
 
     g = findgroup(ng);
     if (g) {
-	sprintf(*s, "%s ", g->name);
+	/*sprintf(*s, "%s ", g->name);*/
+	free(*s);
+	*s = critstrdup(g->name, "do_group");
 	l = ngs ? findinlist(ngs, *s) : NULL;
 	if (l && *l) {
 	    char *t;
diff -ru leafnode-2.0b8_ma9rc1.orig/miscutil.c leafnode-2.0b8_ma9rc1/miscutil.c
--- leafnode-2.0b8_ma9rc1.orig/miscutil.c	Tue Jan  8 09:31:16 2002
+++ leafnode-2.0b8_ma9rc1/miscutil.c	Thu Jan 10 14:44:09 2002
@@ -346,7 +346,6 @@
 	    free(k);
 	    exit(EXIT_FAILURE);
 	}
-	free(k);
     }
     (void)closedir(d);
     mastr_delete(t);
EOF
}

You'll note the miscutil.c patch is the smaller of the two posted.

If I run the above under dmalloc, it fails towards the end with an
allocation error.  But I ran just find without it.  I may try to do some
more testing on that later.

mrc
-- 
     Mike Castle      dalgoda@xxxxxxxxxxxxx      www.netcom.com/~dalgoda/
    We are all of us living in the shadow of Manhattan.  -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list