cvs: php-src /ext/ldap ldap.c /ext/ldap/tests bug48696.phpt
| From: | Felipe Pena | Date: | Thu, 25 Jun 2009 14:48:53 +0000 |
| Subject: | cvs: php-src /ext/ldap ldap.c /ext/ldap/tests bug48696.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-58991@lists.php.net to get a copy of this message | ||
felipe Thu Jun 25 14:48:53 2009 UTC
Added files:
/php-src/ext/ldap/tests bug48696.phpt
Modified files:
/php-src/ext/ldap ldap.c
Log:
- Fixed bug #48696 (ldap_read() segfaults with invalid parameters)
http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.203&r2=1.204&diff_format=u
Index: php-src/ext/ldap/ldap.c
diff -u php-src/ext/ldap/ldap.c:1.203 php-src/ext/ldap/ldap.c:1.204
--- php-src/ext/ldap/ldap.c:1.203 Mon Jun 15 15:18:12 2009
+++ php-src/ext/ldap/ldap.c Thu Jun 25 14:48:53 2009
@@ -23,7 +23,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ldap.c,v 1.203 2009/06/15 15:18:12 patrickallaert Exp $ */
+/* $Id: ldap.c,v 1.204 2009/06/25 14:48:53 felipe Exp $ */
#define IS_EXT_MODULE
#ifdef HAVE_CONFIG_H
@@ -235,7 +235,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.203 2009/06/15 15:18:12
patrickallaert Exp $");
+ php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.204 2009/06/25 14:48:53
felipe Exp $");
if (LDAPG(max_links) == -1) {
snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
@@ -600,7 +600,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;
@@ -817,8 +817,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