diff options
author | foobar <sniper@php.net> | 2003-10-06 23:33:00 +0000 |
---|---|---|
committer | foobar <sniper@php.net> | 2003-10-06 23:33:00 +0000 |
commit | 47484ce5d3a618563507b7e2c465a685628c1147 (patch) | |
tree | bf0e2c21533a6b3d88be5960460df5d11c520808 /ext/ldap | |
parent | 6c9bbe70bf03a122eabd3371458d5d050edb2617 (diff) | |
download | php-git-47484ce5d3a618563507b7e2c465a685628c1147.tar.gz |
- Fixed bug #25764 (ldap_get_option() crashes when called with unbinded ldap link)
Diffstat (limited to 'ext/ldap')
-rw-r--r-- | ext/ldap/ldap.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 122b17285d..4d70b6d439 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -1663,13 +1663,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: |