com php-src: Fix null byte in LDAP bindings: ext/ldap/ldap.c
| From: | Stanislav Malyshev | Date: | Mon, 14 Apr 2014 17:53:08 +0000 |
| Subject: | com php-src: Fix null byte in LDAP bindings: ext/ldap/ldap.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76884@lists.php.net to get a copy of this message | ||
Commit: 9af0756dd563d4eef7ce9492a6abb1b99ef74637
Author: Stanislav Malyshev <stas@php.net> Sun, 13 Apr 2014 20:43:46 -0700
Parents: fb96a62b7d5697ea78be0eba20785ecc07bc9bce
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9af0756dd563d4eef7ce9492a6abb1b99ef74637
Log:
Fix null byte in LDAP bindings
Changed paths:
M ext/ldap/ldap.c
Diff:
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index f5583cd..50055a2 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -405,6 +405,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)
{