diff options
| author | foobar <sniper@php.net> | 2003-10-06 23:34:16 +0000 |
|---|---|---|
| committer | foobar <sniper@php.net> | 2003-10-06 23:34:16 +0000 |
| commit | c057fc931abedbabecc72d89c7701f45b66b4208 (patch) | |
| tree | dcd59115a852cebb3f04e0e3dc56b387a0678380 | |
| parent | 10243d019d0202579bfbce744c23b40f85036226 (diff) | |
| download | php-git-c057fc931abedbabecc72d89c7701f45b66b4208.tar.gz | |
MFH: - Fixed bug #25764 (ldap_get_option() crashes with unbinded ldap link)
| -rw-r--r-- | NEWS | 1 | ||||
| -rw-r--r-- | ext/ldap/ldap.c | 15 |
2 files changed, 12 insertions, 4 deletions
@@ -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) 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: |
