]> granicus.if.org Git - php/commitdiff
Fixed bug #50212 (crash by ldap_get_option() with LDAP_OPT_NETWORK_TIMEOUT).
authorIlia Alshanetsky <iliaa@php.net>
Wed, 18 Nov 2009 13:37:45 +0000 (13:37 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 18 Nov 2009 13:37:45 +0000 (13:37 +0000)
NEWS
ext/ldap/ldap.c

diff --git a/NEWS b/NEWS
index 82a7fe64c736842ca12399ca42b4bf6561db3fc8..a81b95daac5cb85635643d7404a86a2384fc2566 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,8 @@ PHP                                                                        NEWS
 - Fixed memory leak in extension loading when an error occurs on Windows.
   (Pierre)
 
+- Fixed bug #50212 (crash by ldap_get_option() with LDAP_OPT_NETWORK_TIMEOUT).
+  (Ilia, shigeru_kitazaki at cybozu dot co dot jp)
 - Fixed bug #50140 (With default compilation option, php symbols are
   unresolved for nsapi). (Uwe Schindler)
 - Fixed bug #50174 (Incorrectly matched docComment). (Felipe)
index 2a1b9d12f7ba49805bcf060f4bba3d96e2388e02..e78236fde3085e00ce51f10f692cc8547beb66d6 100644 (file)
@@ -1583,14 +1583,17 @@ PHP_FUNCTION(ldap_get_option)
 #ifdef LDAP_OPT_NETWORK_TIMEOUT
        case LDAP_OPT_NETWORK_TIMEOUT:
                {
-                       struct timeval *timeout;
+                       struct timeval *timeout = NULL;
 
                        if (ldap_get_option(ld->link, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) {
                                if (timeout) {
                                        ldap_memfree(timeout);
                                }
                                RETURN_FALSE;
-                       }                      
+                       }                   
+                       if (!timeout) {
+                               RETURN_FALSE;
+                       }
                        zval_dtor(retval);
                        ZVAL_LONG(retval, timeout->tv_sec);
                        ldap_memfree(timeout);