From owner-freebsd-audit Fri Aug 4 21:40:45 2000 Delivered-To: freebsd-audit@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (Postfix) with ESMTP id C653D37B939; Fri, 4 Aug 2000 21:40:41 -0700 (PDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.9.3/8.9.3) with ESMTP id WAA76304; Fri, 4 Aug 2000 22:40:39 -0600 (MDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id WAA14655; Fri, 4 Aug 2000 22:40:31 -0600 (MDT) Message-Id: <200008050440.WAA14655@harmony.village.org> To: Kris Kennaway Subject: Re: strncpy bugs Cc: audit@FreeBSD.org In-reply-to: Your message of "Fri, 04 Aug 2000 18:47:04 PDT." References: Date: Fri, 04 Aug 2000 22:40:31 -0600 From: Warner Losh Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message Kris Kennaway writes: : At least a few, I'd guess. I also noticed fencepost errors in some of the : OpenBSD fixes a while back, although I dont have a record of these and : promised to submit them when I came across them again. Most of the ones that I saw didn't have fencepost errors, although people thought they might. They were of the form strncpy(foo, bar, sizeof(foo)); foo[sizeof(foo) - 1] = '\0'; which some people will whine about saying that the last parameter should be sizeof(foo) - 1, but the above and the following have exactly the same post conditions: strncpy(foo, bar, sizeof(foo) - 1); foo[sizeof(foo) - 1] = '\0'; Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message