From owner-freebsd-audit Wed Feb 7 15:19:13 2001 Delivered-To: freebsd-audit@freebsd.org Received: from harmony.village.org (unknown [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 3F88B37B6C3 for ; Wed, 7 Feb 2001 15:18:54 -0800 (PST) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.11.1/8.11.1) with ESMTP id f17NIj996425; Wed, 7 Feb 2001 16:18:46 -0700 (MST) (envelope-from imp@harmony.village.org) Message-Id: <200102072318.f17NIj996425@harmony.village.org> To: Mike Heffner Subject: Re: lam(1) patch Cc: FreeBSD-audit In-reply-to: Your message of "Wed, 07 Feb 2001 18:00:49 EST." References: Date: Wed, 07 Feb 2001 16:18:45 -0700 From: Warner Losh Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message Mike Heffner writes: : | Also available from: : | http://filebox.vt.edu/users/mheffner/patches/lam.patch : Any objections to me committing this? @@ -130,7 +131,7 @@ ip++; continue; } - switch (*(c = ++p) | 040) { + switch (tolower(*(c = ++p))) { case 's': if (*++p || (p = *++av)) ip->sepstring = p; The tolower function will only evaluate the arguments once, but the tolower macro might evaluate them multiple times. Maybe I'm recalling things too far back. In any event, I'd be tempted to write it like: + c = ++p; + switch (tolower(*c)) { @@ -175,13 +182,12 @@ pad(ip) struct openfile *ip; { - register char *p = ip->sepstring; - register char *lp = linep; + char *lp = linep; - while (*p) - *lp++ = *p++; + strlcpy(lp, ip->sepstring, line + sizeof(line) - lp); + lp += strlen(lp); if (ip->pad) { - sprintf(lp, ip->format, ""); + snprintf(lp, line + sizeof(line) - lp, ip->format, ""); lp += strlen(lp); } return (lp); This appaers to introduce an extra dependencies on line. However, pad() and gatherline() already depend on this to an unhealthy degree, so you aren't introducing any really gross. The code is already somewhat gross :-(. : Also, should I follow it up with a de-__P() patch? Yes. So long as you make all the old K&R style decls into ANSI ones at the same time. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message