Andi Gutmans <[EMAIL PROTECTED]> wrote:
> If you need to use something like strncat()/strncpy() you should use 
> strlcpy()/strlcat(). We changed to these functions a couple of years ago.

in the case of wordwrap(), it is only copying part of the source string,
so strlcat() wouldn't do the job. i figured it'd be more confusing to
mix calls to strncat() and strlcat() in the same function than to just
use strncat() consistently. the destination buffer is verifiably large
enough to handle all of the strncat() calls.

(now, i did think of keeping track of the current position in the
destination buffer and using memcpy(), but it seemed like overkill. the
size of the new buffer could be calculated more intelligently, too, by
taking into account the requested line length and size of the original
text to figure out the maximum number of breaks that will be inserted.
but that's all optimization. i was mainly out to fix the segfault.)

jim

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to