Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jul 1999 13:08:58 -0400 (EDT)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        Paul Hart <hart@iserver.com>
Cc:        freebsd-security@FreeBSD.ORG
Subject:   OpenBSD's strlcpy(3) and strlcat(3)
Message-ID:  <199907151708.NAA12942@khavrinen.lcs.mit.edu>
In-Reply-To: <Pine.BSF.3.96.990715102711.19105A-100000@anchovy.orem.iserver.com>
References:  <Pine.BSF.3.96.990715102711.19105A-100000@anchovy.orem.iserver.com>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Thu, 15 Jul 1999 10:47:23 -0600 (MDT), Paul Hart <hart@iserver.com> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907151708.NAA12942>