Date: Fri, 1 Sep 2000 03:11:15 -0700 (PDT) From: Kris Kennaway <kris@FreeBSD.org> To: Valentin Nechayev <netch@carrier.kiev.ua> Cc: Kris Kennaway <kris@hub.freebsd.org>, freebsd-audit@freebsd.org Subject: Re: ether_line() patch Message-ID: <Pine.BSF.4.21.0009010310250.27842-100000@freefall.freebsd.org> In-Reply-To: <200008291101.OAT56202@burka.carrier.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <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.0009010310250.27842-100000>