1 Star 0 Fork 49

Funda Wang/samba_1

forked from src-openEuler/samba 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-0001-s4-dsdb-strcasecmp_with_ldb_val-avoids-overflow.patch 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
From a00c0ebd090f69f94ce6ba7774a9fc126d7de504 Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Date: Mon, 13 May 2024 11:08:35 +1200
Subject: [PATCH] s4:dsdb:strcasecmp_with_ldb_val() avoids overflow
Reference: https://git.samba.org/?p=samba.git;a=patch;h=a00c0ebd090f69f94ce6ba7774a9fc126d7de504
In the unlikely event that strlen(str) > INT_MAX, the result could
have overflowed.
This is not a sort transitivity issue, as this is not a symmetric sort
comparison, but it would affect binary search reliability.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
---
source4/dsdb/schema/schema_query.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/source4/dsdb/schema/schema_query.c b/source4/dsdb/schema/schema_query.c
index 96c5392..b2e937e 100644
--- a/source4/dsdb/schema/schema_query.c
+++ b/source4/dsdb/schema/schema_query.c
@@ -52,7 +52,9 @@ static int strcasecmp_with_ldb_val(const struct ldb_val *target, const char *str
}
return 1;
}
- return (target->length - len);
+ if (target->length < len) {
+ return -1;
+ }
}
return ret;
}
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fundawang/samba_1.git
git@gitee.com:fundawang/samba_1.git
fundawang
samba_1
samba_1
master

搜索帮助