Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jul 1999 17:38:16 -0600 (MDT)
From:      Paul Hart <hart@iserver.com>
To:        Mike Smith <mike@smith.net.au>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: OpenBSD's strlcpy(3) and strlcat(3) 
Message-ID:  <Pine.BSF.3.96.990715173411.19105E-100000@anchovy.orem.iserver.com>
In-Reply-To: <199907152329.QAA01720@dingo.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 15 Jul 1999, Mike Smith wrote:

> Ugh.  Take the first example in the paper; it rewrites as
> 
> 	len = asprintf(&path, "%s/.foorc");
> 
> as opposed to
> 
> 	strlcat(path, homedir, sizeof(path));
> 	strlcat(path, "/", sizeof(path));
> 	strlcat(path, ".foord", sizeof(path));
> 	len = strlen(path);
> 
> Yes, they're a better str*cat/cpy, but they're not the solution that 
> they claim to be.

I don't think that anyone has intended them to be anything other than a
better replacement for strcpy/strcat than strncpy/strncat (which they
certainly are).  Sure, you could go around telling people "use snprintf
instead" or "use asprintf instead", but is that the issue at hand?

Paul Hart

--
Paul Robert Hart        ><8>  ><8>  ><8>        Verio Web Hosting, Inc.
hart@iserver.com        ><8>  ><8>  ><8>        http://www.iserver.com/



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" 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.3.96.990715173411.19105E-100000>