Date: Fri, 04 Aug 2000 13:27:08 -0600 From: Warner Losh <imp@village.org> To: Kris Kennaway <kris@hub.freebsd.org> Cc: audit@FreeBSD.ORG Subject: Re: ether_line() patch Message-ID: <200008041927.NAA12389@harmony.village.org> In-Reply-To: Your message of "Fri, 04 Aug 2000 03:08:45 PDT." <Pine.BSF.4.21.0008040306140.96614-100000@hub.freebsd.org> References: <Pine.BSF.4.21.0008040306140.96614-100000@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <Pine.BSF.4.21.0008040306140.96614-100000@hub.freebsd.org> Kris Kennaway writes: : @@ -156,7 +178,7 @@ : strlen(ether_a), &result, &resultlen)) { : continue; : } : - strncpy(buf, result, resultlen); : + strncpy(buf, result, resultlen - 1); : buf[resultlen] = '\0'; : free(result); : } : This change is wrong. The strcpy puts upto resultlen characters into buf, and then null terminates it at the resultlen + 1st character (counting from 1). The strncpy should therefore not have the -1. Or the line setting the buf[] = 0 should have it as well. Warner 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?200008041927.NAA12389>