batcher(8) dumps core on NetBSD/sparc64

Holger Weiss holger at weiss.in-berlin.de
Wed Sep 5 14:30:42 UTC 2007


* Holger Weiss <holger at weiss.in-berlin.de> [2007-09-05 14:08]:
> INN 2.4.3's batcher(8) dumps core with a bus error on NetBSD/sparc64
> (presumably on any platform which has sizeof(size_t) != sizeof(int) and
> requires alignment).  This happens because backends/batcher.c hands the
> address of the int BytesInArt over to storage/interface.c:FromWireFmt()
> which then dereferences it as a size_t:
> | (gdb) where
> | #0  FromWireFmt (
> |     article=0x22a400 "Path: news"..., len=634, newlen=0xffffffffffffc34c)
> |     at interface.c:198
> | #1  0x0000000000102c8c in main (ac=<value optimized out>,
> |     av=<value optimized out>) at batcher.c:334
>
> This is fixed in SVN trunk already, I've attached a patch for the 2.4
> branch.

Hmm, it seems this list (silently) strips attachments?  Second try:

Index: backends/batcher.c
===================================================================
--- backends/batcher.c	(revision 7668)
+++ backends/batcher.c	(working copy)
@@ -191,8 +191,8 @@
     char	*data;
     char	line[BIG_BUFFER];
     char	buff[BIG_BUFFER];
-    int		BytesInArt;
-    long	BytesInCB;
+    size_t	BytesInArt;
+    size_t	BytesInCB;
     off_t	Cookie;
     size_t	datasize;
     int		i;
@@ -306,13 +306,8 @@
 	*p = '\0';
 	if (line[0] == '\0' || line[0] == '#')
 	    continue;
-	if ((p = strchr(line, ' ')) != NULL) {
-	    *p++ = '\0';
-	    /* Try to be forgiving of bad input. */
-	    BytesInArt = CTYPE(isdigit, (int)*p) ? atol(p) : -1;
-	}
-	else
-	    BytesInArt = -1;
+	if ((p = strchr(line, ' ')) != NULL)
+	    *p = '\0';
 
 	/* Strip of leading spool pathname. */
 	if (line[0] == '/'
@@ -330,8 +325,7 @@
                     warn("%s skipping %.40s: %s", Host, p, SMerrorstr);
 		continue;
 	    }
-	    BytesInArt = -1;
-	    artdata = FromWireFmt(art->data, art->len, (size_t *)&BytesInArt);
+	    artdata = FromWireFmt(art->data, art->len, &BytesInArt);
 	    SMfreearticle(art);
 	} else {
             warn("%s skipping %.40s: not token", Host, p);

Holger


More information about the inn-workers mailing list