Re: should strings always be 0-terminated?

From: Date: Sun, 12 Nov 2000 13:26:44 +0000
Subject: Re: should strings always be 0-terminated?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-37816@lists.php.net to get a copy of this message
On Sun, 12 Nov 2000, Stig Venaas wrote: > A quick question: > > Should the string pointed to by value.str.val always be 0-terminated? > Or should all code accessing the pval/zval use value.str.len? Since > strings sometimes contain binary data, I would think value.str.len > was used, but I'm not surprised if the 0 is necessary. Should all > code relying on a terminating 0 be changed? Not all code can be made binary safe (think of library functions which take C "strings"). It is generally recommened to NUL terminate strings and to always set value.str.len properly. - Sascha

« previous php.dev (#37816) next »