Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Aug 2000 14:27:59 -0700 (PDT)
From:      Kris Kennaway <kris@hub.freebsd.org>
To:        Warner Losh <imp@village.org>
Cc:        audit@FreeBSD.ORG
Subject:   Re: ether_line() patch 
Message-ID:  <Pine.BSF.4.21.0008041423330.68512-100000@hub.freebsd.org>
In-Reply-To: <200008042122.PAA13032@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <forsythe@alum.mit.edu>



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0008041423330.68512-100000>