From owner-freebsd-audit Fri Aug 4 14:28: 1 2000 Delivered-To: freebsd-audit@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 758) id CCACD37B8C5; Fri, 4 Aug 2000 14:27:59 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id CA97E2E8196; Fri, 4 Aug 2000 14:27:59 -0700 (PDT) (envelope-from kris@hub.freebsd.org) Date: Fri, 4 Aug 2000 14:27:59 -0700 (PDT) From: Kris Kennaway To: Warner Losh Cc: audit@FreeBSD.ORG Subject: Re: ether_line() patch In-Reply-To: <200008042122.PAA13032@harmony.village.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 4 Aug 2000, Warner Losh wrote: > This is incorrect too. It should be buf[sizeof(buf) - 1] = '\0'; > because the valid range of buf is [0..sizeof(buf) - 1]. You don't > need the -1 on strncpy, but that's a style issue. The post conditions > are identical with it or without it: Oops again :) This change was just intended to be the above style issue/micro-optimization (until I noticed the real bug in the old code). In this case sizeof(buf) - 1 should still be correctly optimized by the compiler since it's a compile-time constant, right? Kris -- In God we Trust -- all others must submit an X.509 certificate. -- Charles Forsythe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message