sas Sat Feb 8 13:58:34 2003 EDT
Modified files:
/php4/ext/gettext gettext.c
Log:
Fix segfault in bindtextdomain when first parameter was empty.
The Linux man page states: domainname must be a non-empty string.
Noticed by: Nils Meyer
Index: php4/ext/gettext/gettext.c
diff -u php4/ext/gettext/gettext.c:1.40 php4/ext/gettext/gettext.c:1.41
--- php4/ext/gettext/gettext.c:1.40 Tue Dec 31 11:06:40 2002
+++ php4/ext/gettext/gettext.c Sat Feb 8 13:58:34 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gettext.c,v 1.40 2002/12/31 16:06:40 sebastian Exp $ */
+/* $Id: gettext.c,v 1.41 2003/02/08 18:58:34 sas Exp $ */
#include <stdio.h>
#ifdef HAVE_CONFIG_H
@@ -178,7 +178,12 @@
convert_to_string_ex(domain_name);
convert_to_string_ex(dir);
- if (strcmp(Z_STRVAL_PP(dir), "") && strcmp(Z_STRVAL_PP(dir), "0")) {
+ if (Z_STRVAL_PP(domain_name)[0] == '\0') {
+ php_error(E_WARNING, "The first parameter of bindtextdomain must not
+be empty");
+ RETURN_FALSE;
+ }
+
+ if (Z_STRVAL_PP(dir)[0] != '\0' && strcmp(Z_STRVAL_PP(dir), "0")) {
VCWD_REALPATH(Z_STRVAL_PP(dir), dir_name);
} else {
VCWD_GETCWD(dir_name, MAXPATHLEN);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php