From owner-freebsd-security Thu Jul 15 10:10:41 1999 Delivered-To: freebsd-security@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 73D3D155AA for ; Thu, 15 Jul 1999 10:10:30 -0700 (PDT) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.9.1/8.9.1) id NAA12942; Thu, 15 Jul 1999 13:08:58 -0400 (EDT) (envelope-from wollman) Date: Thu, 15 Jul 1999 13:08:58 -0400 (EDT) From: Garrett Wollman Message-Id: <199907151708.NAA12942@khavrinen.lcs.mit.edu> To: Paul Hart Cc: freebsd-security@FreeBSD.ORG Subject: OpenBSD's strlcpy(3) and strlcat(3) In-Reply-To: References: Sender: owner-freebsd-security@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org < said: > The semantics of strncpy(3) and strncat(3) have struck me as warts > on the C standard for some time. I'm not sure what debate took > place on the standardization committee, but whatever it was seems to > have produced some strange results. These functions were not creations of the committee -- they have been in C for a very long time. They (along with strncmp()) were originally created for the purpose of dealing with `struct direct' in Seventh Edition, which looked something like this (I've probably got the member names wrong): struct direct { int d_ino; char d_name[MAXNAMLEN]; }; The `d_name' member defined the semantics of strncpy() and strncmp(). X3J11 standardized these functions as they were. -GAWollman -- Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same wollman@lcs.mit.edu | O Siem / The fires of freedom Opinions not those of| Dance in the burning flame MIT, LCS, CRS, or NSA| - Susan Aglukark and Chad Irschick To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-security" in the body of the message