Skip to content

Commit

Permalink
Fixed bug #50212 (crash by ldap_get_option() with LDAP_OPT_NETWORK_TI…
Browse files Browse the repository at this point in the history
…MEOUT).
  • Loading branch information
Ilia Alshanetsky committed Nov 18, 2009
1 parent bdef3ee commit b7bb8aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions ext/ldap/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b7bb8aa

Please sign in to comment.