http://cvs.php.net/viewvc.cgi/php-src/ext/standard/metaphone.c?r1=1.28.2.1.2.5&r2=1.28.2.1.2.6&diff_format=u
Index: php-src/ext/standard/metaphone.c
diff -u php-src/ext/standard/metaphone.c:1.28.2.1.2.5 php-src/ext/standard/metaphone.c:1.28.2.1.2.6
--- php-src/ext/standard/metaphone.c:1.28.2.1.2.5 Mon Dec 31 07:20:13 2007
+++ php-src/ext/standard/metaphone.c Mon Feb 25 22:40:45 2008
@@ -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)

uhm, this fix is a bit weird, as *phoned_word == safe_emalloc(sizeof(char), max_buffer_len, 1);. This means that the realloc seems to be a noop (at first sight, at least). Also, you should use safe_erealloc() there instead (if you persist on this fix).

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

Reply via email to