]> granicus.if.org Git - php/commitdiff
MFH: - Fixed bug #25764 (ldap_get_option() crashes with unbinded ldap link)
authorfoobar <sniper@php.net>
Mon, 6 Oct 2003 23:34:16 +0000 (23:34 +0000)
committerfoobar <sniper@php.net>
Mon, 6 Oct 2003 23:34:16 +0000 (23:34 +0000)
NEWS
ext/ldap/ldap.c

diff --git a/NEWS b/NEWS
index 34ec92cd325d5d46daed3899640158e4e5b606f0..7cdfef290c943349f7ce426751aec1085a555897 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP 4                                                                      NEWS
 ?? Oct 2003, Version 4.3.4RC2
 - Fixed multibyte regex engine to properly handle ".*" pattern under
   POSIX compatible mode. (K.Kosako <kosako at sofnec.co.jp>, Moriyoshi)
+- Fixed bug #25764 (ldap_get_option() crashes with unbinded ldap link). (Jani)
 - Fixed bug #25752 (ext/ncurses: ncurses.h instead of curses.h with BSD). (Jani)
 - Fixed bug #25745 (ctype functions fail with non-ascii characters). (Moriyoshi)
 - Fixed bug #25744 (make ZTS build of ext/sybase compile). (Ilia)
index f1e4ae432972df8b6058916893914f6275a3ed24..d980e4e52a6514c9e1827367563b462d5a194738 100644 (file)
@@ -1613,13 +1613,20 @@ PHP_FUNCTION(ldap_get_option)
        case LDAP_OPT_MATCHED_DN:
 #endif
                {
-                       char *val;
+                       char *val = NULL;
+
                        if (ldap_get_option(ld->link, opt, &val)) {
                                RETURN_FALSE;
                        }
-                       zval_dtor(*retval);
-                       ZVAL_STRING(*retval, val, 1);
-                       ldap_memfree(val);
+                       if (val != NULL) {
+                               if (*val != '\0') {
+                                       zval_dtor(*retval);
+                                       ZVAL_STRING(*retval, val, 1);
+                               }
+                               ldap_memfree(val);
+                       } else {
+                               RETURN_FALSE;
+                       }
                } break;
 /* options not implemented
        case LDAP_OPT_SERVER_CONTROLS: