Subject: Re: bin/34979: -current libc causes boot failure
To: Scott Ellis <scotte@warped.com>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 11/12/2006 21:17:01
On Nov 12,  5:19pm, scotte@warped.com (Scott Ellis) wrote:
-- Subject: Re: bin/34979: -current libc causes boot failure

| Christos Zoulas wrote:
| [snip]
| > Try this (which returns a match if prog/from is empty):
| > 
| > Index: syslogd.c
| > ===================================================================
| > RCS file: /cvsroot/src/usr.sbin/syslogd/syslogd.c,v
| > retrieving revision 1.82
| > diff -u -u -r1.82 syslogd.c
| > --- syslogd.c	16 Sep 2006 17:05:32 -0000	1.82
| > +++ syslogd.c	13 Nov 2006 00:51:26 -0000
| [snip]
| 
| Actually, it looks like this check is already effectively in 1.83. 
| (Psst, your syslogd.c is out of date...you should have /*      $NetBSD: 
| syslogd.c,v 1.83 2006/10/21 09:42:26 yamt Exp $        */ )
| 

No, my check checks for an empty name; the other check checks for a comma
in the name. Here's a patch against current.

christos

Index: syslogd.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.83
diff -u -u -r1.83 syslogd.c
--- syslogd.c	21 Oct 2006 09:42:26 -0000	1.83
+++ syslogd.c	13 Nov 2006 02:16:06 -0000
@@ -882,14 +882,19 @@
 	const char *s;
 	const char *cursor;
 	char prev, next;
+	size_t len;
+
+	if (name[0] == '\0')
+		return (0);
 
 	if (strchr(name, ',')) /* sanity */
 		return (0);
 
+	len = strlen(name);
 	cursor = spec;
 	while ((s = (*check)(cursor, name)) != NULL) {
 		prev = s == spec ? ',' : *(s - 1);
-		cursor = s + strlen(name);
+		cursor = s + len;
 		next = *cursor;
 
 		if (prev == ',' && (next == '\0' || next == ','))