9 Star 0 Fork 26

src-openEuler/unbound

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-002-CVE-2024-43168.patch 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
eaglegai 提交于 2024-08-26 08:08 . fix CVE-2024-43168 better
From dfff8d23cf4145c58e5c1e99d4159d3a91a70ab7 Mon Sep 17 00:00:00 2001
From: "W.C.A. Wijngaards" <wouter@nlnetlabs.nl>
Date: Wed, 3 Apr 2024 10:16:18 +0200
Subject: [PATCH] - For #1040: adjust error text and disallow negative ports in
other parts of cfg_mark_ports.
---
util/config_file.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/util/config_file.c b/util/config_file.c
index e7b2f195..74554286 100644
--- a/util/config_file.c
+++ b/util/config_file.c
@@ -1762,7 +1762,7 @@ cfg_mark_ports(const char* str, int allow, int* avail, int num)
if(!mid) {
int port = atoi(str);
if(port < 0) {
- log_err("Prevent out-of-bounds access to array avail");
+ log_err("port number is negative: %d", port);
return 0;
}
if(port == 0 && strcmp(str, "0") != 0) {
@@ -1774,6 +1774,10 @@ cfg_mark_ports(const char* str, int allow, int* avail, int num)
} else {
int i, low, high = atoi(mid+1);
char buf[16];
+ if(high < 0) {
+ log_err("port number is negative: %d", high);
+ return 0;
+ }
if(high == 0 && strcmp(mid+1, "0") != 0) {
log_err("cannot parse port number '%s'", mid+1);
return 0;
@@ -1786,10 +1790,18 @@ cfg_mark_ports(const char* str, int allow, int* avail, int num)
memcpy(buf, str, (size_t)(mid-str));
buf[mid-str] = 0;
low = atoi(buf);
+ if(low < 0) {
+ log_err("port number is negative: %d", low);
+ return 0;
+ }
if(low == 0 && strcmp(buf, "0") != 0) {
log_err("cannot parse port number '%s'", buf);
return 0;
}
+ if(high > num) {
+ /* Stop very high values from taking a long time. */
+ high = num;
+ }
for(i=low; i<=high; i++) {
if(i < num)
avail[i] = (allow?i:0);
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/unbound.git
git@gitee.com:src-openeuler/unbound.git
src-openeuler
unbound
unbound
master

搜索帮助