cvs: php-src(PHP_5_3) /ext/standard metaphone.c /ext/standard/tests/strings bug44242.phpt
| From: | Felipe Pena | Date: | Mon, 25 Feb 2008 22:54:58 +0000 |
| Subject: | cvs: php-src(PHP_5_3) /ext/standard metaphone.c /ext/standard/tests/strings bug44242.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-48760@lists.php.net to get a copy of this message | ||
felipe Mon Feb 25 22:54:58 2008 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings bug44242.phpt
Modified files:
/php-src/ext/standard metaphone.c
Log:
MFB: Fixed bug #44242 (metaphone('CMXFXM') crashes PHP)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/metaphone.c?r1=1.28.2.1.2.4.2.1&r2=1.28.2.1.2.4.2.2&diff_format=u
Index: php-src/ext/standard/metaphone.c
diff -u php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.1
php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.2
--- php-src/ext/standard/metaphone.c:1.28.2.1.2.4.2.1 Mon Dec 31 07:17:15 2007
+++ php-src/ext/standard/metaphone.c Mon Feb 25 22:54:57 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: metaphone.c,v 1.28.2.1.2.4.2.1 2007/12/31 07:17:15 sebastian Exp $ */
+/* $Id: metaphone.c,v 1.28.2.1.2.4.2.2 2008/02/25 22:54:57 felipe Exp $ */
/*
Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern <schwern@pobox.com>
@@ -150,7 +150,12 @@
(*phoned_word)[p_idx++] = c; \
}
/* Slap a null character on the end of the phoned word */
-#define End_Phoned_Word {(*phoned_word)[p_idx] = '\0';}
+#define End_Phoned_Word { \
+ if (p_idx == max_buffer_len) { \
+ *phoned_word = erealloc(*phoned_word, max_buffer_len + 1); \
+ } \
+ (*phoned_word)[p_idx] = '\0'; \
+ }
/* How long is the phoned word? */
#define Phone_Len (p_idx)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug44242.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/bug44242.phpt
+++ php-src/ext/standard/tests/strings/bug44242.phpt