Sigh, I wonder how many str*l* functions were introduced that were incorrect?

Looks like there wasn't an understanding that strlcat is for the destination 
not source.
On Aug 19, 2011, at 3:49 PM, Stanislav Malyshev wrote:

> stas                                     Fri, 19 Aug 2011 22:49:18 +0000
> 
> Revision: http://svn.php.net/viewvc?view=revision&revision=315218
> 
> Log:
> Unbreak crypt() (fix bug #55439)
> # If you want to remove static analyser messages, be my guest,
> # but please run unit tests after
> 
> Bug: https://bugs.php.net/55439 (Assigned) crypt() returns only the salt for 
> MD5
> 
> Changed paths:
>    U   php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c
>    U   php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c
>    U   php/php-src/trunk/ext/standard/php_crypt_r.c
> 
> Modified: php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c
> ===================================================================
> --- php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c   2011-08-19 
> 22:45:43 UTC (rev 315217)
> +++ php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c   2011-08-19 
> 22:49:18 UTC (rev 315218)
> @@ -382,7 +382,7 @@
>       /* Now make the output string */
>       memcpy(passwd, MD5_MAGIC, MD5_MAGIC_LEN);
>       strlcpy(passwd + MD5_MAGIC_LEN, sp, sl + 1);
> -     strlcat(passwd, "$", 1);
> +     strcat(passwd, "$");
> 
>       PHP_MD5Final(final, &ctx);
> 
> 
> Modified: php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c
> ===================================================================
> --- php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c   2011-08-19 
> 22:45:43 UTC (rev 315217)
> +++ php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c   2011-08-19 
> 22:49:18 UTC (rev 315218)
> @@ -377,7 +377,7 @@
>       /* Now make the output string */
>       memcpy(passwd, MD5_MAGIC, MD5_MAGIC_LEN);
>       strlcpy(passwd + MD5_MAGIC_LEN, sp, sl + 1);
> -     strlcat(passwd, "$", 1);
> +     strcat(passwd, "$");
> 
>       PHP_MD5Final(final, &ctx);
> 
> 
> Modified: php/php-src/trunk/ext/standard/php_crypt_r.c
> ===================================================================
> --- php/php-src/trunk/ext/standard/php_crypt_r.c      2011-08-19 22:45:43 UTC 
> (rev 315217)
> +++ php/php-src/trunk/ext/standard/php_crypt_r.c      2011-08-19 22:49:18 UTC 
> (rev 315218)
> @@ -377,7 +377,7 @@
>       /* Now make the output string */
>       memcpy(passwd, MD5_MAGIC, MD5_MAGIC_LEN);
>       strlcpy(passwd + MD5_MAGIC_LEN, sp, sl + 1);
> -     strlcat(passwd, "$", 1);
> +     strcat(passwd, "$");
> 
>       PHP_MD5Final(final, &ctx);
> 
> 
> -- 
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to