johannes Thu Jun 25 15:19:30 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/ldap/tests bug48696.phpt
Modified files:
/php-src/ext/ldap ldap.c
Log:
MFH: Fixed bug #48696 (ldap_read() segfaults with invalid parameters) (Felipe)
http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.161.2.3.2.11.2.29&r2=1.161.2.3.2.11.2.30&diff_format=u
Index: php-src/ext/ldap/ldap.c
diff -u php-src/ext/ldap/ldap.c:1.161.2.3.2.11.2.29
php-src/ext/ldap/ldap.c:1.161.2.3.2.11.2.30
--- php-src/ext/ldap/ldap.c:1.161.2.3.2.11.2.29 Mon Jun 15 15:18:31 2009
+++ php-src/ext/ldap/ldap.c Thu Jun 25 15:19:29 2009
@@ -23,7 +23,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ldap.c,v 1.161.2.3.2.11.2.29 2009/06/15 15:18:31 patrickallaert Exp $
*/
+/* $Id: ldap.c,v 1.161.2.3.2.11.2.30 2009/06/25 15:19:29 johannes Exp $ */
#define IS_EXT_MODULE
#ifdef HAVE_CONFIG_H
@@ -224,7 +224,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "LDAP Support", "enabled");
- php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v
1.161.2.3.2.11.2.29 2009/06/15 15:18:31 patrickallaert Exp $");
+ php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v
1.161.2.3.2.11.2.30 2009/06/25 15:19:29 johannes Exp $");
if (LDAPG(max_links) == -1) {
snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
@@ -589,7 +589,7 @@
char *ldap_base_dn = NULL;
char *ldap_filter = NULL;
char **ldap_attrs = NULL;
- ldap_linkdata *ld;
+ ldap_linkdata *ld = NULL;
LDAPMessage *ldap_res;
int ldap_attrsonly = 0;
int ldap_sizelimit = -1;
@@ -806,8 +806,10 @@
}
cleanup:
- // Restoring previous options
- php_set_opts(ld->link, old_ldap_sizelimit, old_ldap_timelimit,
old_ldap_deref, &ldap_sizelimit, &ldap_timelimit, &ldap_deref);
+ if (ld) {
+ /* Restoring previous options */
+ php_set_opts(ld->link, old_ldap_sizelimit, old_ldap_timelimit,
old_ldap_deref, &ldap_sizelimit, &ldap_timelimit, &ldap_deref);
+ }
if (ldap_attrs != NULL) {
efree(ldap_attrs);
}
http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/tests/bug48696.phpt?view=markup&rev=1.1
Index: php-src/ext/ldap/tests/bug48696.phpt
+++ php-src/ext/ldap/tests/bug48696.phpt
--TEST--
Bug #48696 (ldap_read() segfaults with invalid parameters)
--FILE--
<?php
ldap_read(1,1,1);
?>
--EXPECTF--
Warning: ldap_read(): supplied argument is not a valid ldap link resource in %s
on line %d
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php