Re: [PHP4BETA] moving uses of strncpy/cat to srtlcpy/cat?
| From: | Andi Gutmans | Date: | Tue, 14 Sep 1999 05:20:14 +0000 |
| Subject: | Re: [PHP4BETA] moving uses of strncpy/cat to srtlcpy/cat? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-4411@lists.php.net to get a copy of this message | ||
I think that in most ways strlcpy/strlcat are more intuitive than strncpy/strncat. It does seem as if they make it easier to use these string functions and that it really is harder to make mistakes with them.
However, as you mentioned they are not standard and have not made it into glibc.
The question is if there are any free general-purpose implementations which are still as fast or faster than strncpy/strncat. I can see the platform specific ones are faster but the question is if you can find a general-purpose one which is too.
Andi
At 04:55 PM 9/13/99 -0600, Joey wrote:
Are any of you familiar with strlcpy/cat as used in OpenBSD? They are supposedly faster/safer versions of strncpy/cat... make buffer overruns (impossible|less likely), and strlcat does not zero fill as strncat does... Anyone think it would be good to use these? I tried to get Ulrich Drepper (glibc maint.) to look into them for glibc, but his attitude was "no one should ever use str*cat anyway, and why do I need a new str*cpy?"...but Theo de Raadt (sp?) makes a great argument _FOR_ them... http://www.openbsd.org/papers/strlcpy-paper.ps OR if you prefer PDF http://www.xmission.com/~smit5898/strlcpy-paper.pdf--- Andi Gutmans <andi@zend.com> http://www.zend.com/--Joey Smith-- PHP 4 Beta