Re: cvs: php-src(PHP_5_2) / NEWS /ext/standard metaphone.c /ext/standard/tests/strings bug44242.phpt

From: Date: Mon, 25 Feb 2008 23:23:55 +0000
Subject: Re: cvs: php-src(PHP_5_2) / NEWS /ext/standard metaphone.c /ext/standard/tests/strings bug44242.phpt
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-48764@lists.php.net to get a copy of this message
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

« previous php.cvs (#48764) next »