From: foobar Date: Mon, 6 Oct 2003 23:34:16 +0000 (+0000) Subject: MFH: - Fixed bug #25764 (ldap_get_option() crashes with unbinded ldap link) X-Git-Tag: php-4.3.4RC2~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c057fc931abedbabecc72d89c7701f45b66b4208;p=php MFH: - Fixed bug #25764 (ldap_get_option() crashes with unbinded ldap link) --- diff --git a/NEWS b/NEWS index 34ec92cd32..7cdfef290c 100644 --- 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 , 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) diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index f1e4ae4329..d980e4e52a 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -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: