1 Star 0 Fork 41

xh / openldap

forked from src-openEuler / openldap 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CVE-2020-36222-2.patch 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
From 6ed057b5b728b50746c869bcc9c1f85d0bbbf6ed Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Fri, 27 Nov 2020 14:37:10 +0000
Subject: [PATCH] ITS#9406, #9407 remove saslauthz asserts
---
servers/slapd/saslauthz.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/servers/slapd/saslauthz.c b/servers/slapd/saslauthz.c
index e05f3f9cf..2e59eb559 100644
--- a/servers/slapd/saslauthz.c
+++ b/servers/slapd/saslauthz.c
@@ -180,14 +180,16 @@ int slap_parse_user( struct berval *id, struct berval *user,
}
if ( !BER_BVISNULL( mech ) ) {
- assert( mech->bv_val == id->bv_val + 2 );
+ if ( mech->bv_val != id->bv_val + 2 )
+ return LDAP_PROTOCOL_ERROR;
AC_MEMCPY( mech->bv_val - 2, mech->bv_val, mech->bv_len + 1 );
mech->bv_val -= 2;
}
if ( !BER_BVISNULL( realm ) ) {
- assert( realm->bv_val >= id->bv_val + 2 );
+ if ( realm->bv_val < id->bv_val + 2 )
+ return LDAP_PROTOCOL_ERROR;
AC_MEMCPY( realm->bv_val - 2, realm->bv_val, realm->bv_len + 1 );
realm->bv_val -= 2;
@@ -449,9 +451,12 @@ is_dn: bv.bv_len = in->bv_len - ( bv.bv_val - in->bv_val );
}
/* Grab the searchbase */
- assert( ludp->lud_dn != NULL );
- ber_str2bv( ludp->lud_dn, 0, 0, &bv );
- rc = dnValidate( NULL, &bv );
+ if ( ludp->lud_dn != NULL ) {
+ ber_str2bv( ludp->lud_dn, 0, 0, &bv );
+ rc = dnValidate( NULL, &bv );
+ } else {
+ rc = LDAP_INVALID_SYNTAX;
+ }
done:
ldap_free_urldesc( ludp );
@@ -813,7 +818,6 @@ is_dn: bv.bv_len = val->bv_len - ( bv.bv_val - val->bv_val );
}
/* Grab the searchbase */
- assert( ludp->lud_dn != NULL );
if ( ludp->lud_dn ) {
struct berval out = BER_BVNULL;
@@ -831,6 +835,9 @@ is_dn: bv.bv_len = val->bv_len - ( bv.bv_val - val->bv_val );
}
ludp->lud_dn = out.bv_val;
+ } else {
+ rc = LDAP_INVALID_SYNTAX;
+ goto done;
}
ludp->lud_port = 0;
--
GitLab
1
https://gitee.com/xinghe_1/openldap.git
git@gitee.com:xinghe_1/openldap.git
xinghe_1
openldap
openldap
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891