summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2014-04-13 20:43:46 -0700
committerStanislav Malyshev <stas@php.net>2014-04-14 10:44:53 -0700
commitad1b9eef98df53adefa0c79c02e5dc1f2b928b8c (patch)
tree05c8507407c76d8323bcb3d8a336e312193ddaec
parent40a9316dff6e043b534844b2ab167318250be277 (diff)
downloadphp-git-ad1b9eef98df53adefa0c79c02e5dc1f2b928b8c.tar.gz
Fix null byte in LDAP bindings
-rw-r--r--NEWS3
-rw-r--r--ext/ldap/ldap.c10
2 files changed, 13 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 66f0d05645..2d98de7fa0 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,9 @@ PHP NEWS
. Fixed bug #66021 (Blank line inside empty array/object when
JSON_PRETTY_PRINT is set). (Kevin Israel)
+- LDAP:
+ . Fixed issue with null bytes in LDAP bindings. (Matthew Daley)
+
- SimpleXML:
. Fixed bug #66084 (simplexml_load_string() mangles empty node name)
(Anatol)
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 9d3a710b60..9fe48a03aa 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -399,6 +399,16 @@ PHP_FUNCTION(ldap_bind)
RETURN_FALSE;
}
+ if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "DN contains a null byte");
+ RETURN_FALSE;
+ }
+
+ if (ldap_bind_pw != NULL && memchr(ldap_bind_pw, '\0', ldap_bind_pwlen) != NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Password contains a null byte");
+ RETURN_FALSE;
+ }
+
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, &link, -1, "ldap link", le_link);
if ((rc = ldap_bind_s(ld->link, ldap_bind_dn, ldap_bind_pw, LDAP_AUTH_SIMPLE)) != LDAP_SUCCESS) {