From owner-freebsd-audit Fri Sep 1 3:11:16 2000 Delivered-To: freebsd-audit@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 3570137B422; Fri, 1 Sep 2000 03:11:15 -0700 (PDT) Received: from localhost (kris@localhost) by freefall.freebsd.org (8.9.3/8.9.2) with ESMTP id DAA39085; Fri, 1 Sep 2000 03:11:15 -0700 (PDT) (envelope-from kris@FreeBSD.org) X-Authentication-Warning: freefall.freebsd.org: kris owned process doing -bs Date: Fri, 1 Sep 2000 03:11:15 -0700 (PDT) From: Kris Kennaway To: Valentin Nechayev Cc: Kris Kennaway , freebsd-audit@freebsd.org Subject: Re: ether_line() patch In-Reply-To: <200008291101.OAT56202@burka.carrier.kiev.ua> 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 Tue, 29 Aug 2000, Valentin Nechayev wrote: > KK> @@ -156,8 +178,8 @@ > KK> strlen(ether_a), &result, &resultlen)) { > KK> continue; > KK> } > KK> - strncpy(buf, result, resultlen); > KK> - buf[resultlen] = '\0'; > KK> + strncpy(buf, result, sizeof(buf) - 1); > KK> + buf[sizeof(buf)] = '\0'; > KK> free(result); > > Will it be better to write `strlcpy(buf, result, sizeof(buf))' ? I deliberately didnt do that to avoid the gratuitous change of function for no functional gain. If this was new code I'd definitely prefer strlcpy() 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