RE: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard basic_functions.c /ext/standard/tests/network ip.phpt
| From: | Andi Gutmans | Date: | Tue, 21 Aug 2007 05:09:08 +0000 |
| Subject: | RE: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard basic_functions.c /ext/standard/tests/network ip.phpt | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-45941@lists.php.net to get a copy of this message | ||
There are some convenience functions in zend_operators.h which would save having to repeat this
logic (I think they are called zend_binary_strcmp() and zend_binary_zval_strcmp()).
Andi
> -----Original Message-----
> From: Antony Dovgal [mailto:antony@zend.com]
> Sent: Thursday, August 16, 2007 3:35 PM
> To: Jani Taskinen
> Cc: php-cvs@lists.php.net
> Subject: Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard
> basic_functions.c /ext/standard/tests/network ip.phpt
>
> On 17.08.2007 02:17, Jani Taskinen wrote:
> > - if (!memcmp(Z_STRVAL_PP(str), "255.255.255.255",
> Z_STRLEN_PP(str))) {
> > + if (!memcmp(Z_STRVAL_PP(str), "255.255.255.255",
> sizeof("255.255.255.255") - 1)) {
> > RETURN_LONG(-1);
> > }
>
> Are you sure it is correct to compare first 15 bytes of _empty string_
> with "255.255.255.255"?
> I'd say it should look like this:
>
> if (Z_STRLEN_PP(str) == (sizeof("255.255.255.255") - 1) &&
> !memcmp(Z_STRVAL_PP(str), "255.255.255.255", Z_STRLEN_PP(str))) {
>
>
> --
> Wbr,
> Antony Dovgal
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php