10 Star 0 Fork 20

src-openEuler/dnsmasq

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-buffer-overflow-when-configured-lease-change-scr.patch 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
From ae85ea38581e97445622d2dad79cd09775cb201a Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Thu, 21 Nov 2024 15:42:49 +0000
Subject: [PATCH] Fix buffer overflow when configured lease-change script name
is too long.
Thanks to Daniel Rhea for finding this one.
Reference:https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=patch;h=ae85ea38581e97445622d2dad79cd09775cb201a
Conflict:NA
---
src/lease.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lease.c b/src/lease.c
index 1a9f1c6..a944fbb 100644
--- a/src/lease.c
+++ b/src/lease.c
@@ -155,6 +155,10 @@ void lease_init(time_t now)
#ifdef HAVE_SCRIPT
if (daemon->lease_change_command)
{
+ /* 6 == strlen(" init") plus terminator */
+ if (strlen(daemon->lease_change_command) + 6 > DHCP_BUFF_SZ)
+ die(_("lease-change script name is too long"), NULL, EC_FILE);
+
strcpy(daemon->dhcp_buff, daemon->lease_change_command);
strcat(daemon->dhcp_buff, " init");
leasestream = popen(daemon->dhcp_buff, "r");
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/dnsmasq.git
git@gitee.com:src-openeuler/dnsmasq.git
src-openeuler
dnsmasq
dnsmasq
master

搜索帮助