com php-src: fix infinite loop: ext/standard/string.c
| From: | Anatol Belski | Date: | Fri, 24 Oct 2014 22:32:45 +0000 |
| Subject: | com php-src: fix infinite loop: ext/standard/string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82646@lists.php.net to get a copy of this message | ||
Commit: 010f4b797922ab914c553d0d2db000058a7b303f
Author: Anatol Belski <ab@php.net> Sat, 25 Oct 2014 00:32:45 +0200
Parents: 1b4fd5825a820873e4ed0f326bcb890e660dc39c
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=010f4b797922ab914c553d0d2db000058a7b303f
Log:
fix infinite loop
Changed paths:
M ext/standard/string.c
Diff:
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 1d9948d..b60baa6 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2764,13 +2764,13 @@ PHP_FUNCTION(ucwords)
PHPAPI char *php_strtr(char *str, size_t len, char *str_from, char *str_to, size_t trlen)
{
size_t i;
- unsigned char xlat[256], j;
+ unsigned char xlat[256], j = 0;
if ((trlen < 1) || (len < 1)) {
return str;
}
- for (j = 0; j < 256; xlat[j] = j, j++);
+ do { xlat[j] = j; } while (++j != 0);
for (i = 0; i < trlen; i++) {
xlat[(size_t) str_from[i]] = str_to[i];