加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-sd-lldp-use-memcpy_safe-as-the-buffer-size-may-be-ze.patch 986 Bytes
一键复制 编辑 原始数据 按行查看 历史
hongjinghao 提交于 2023-06-19 10:57 . sync patches from systemd community
From 5e069e405a73ff5a406598436fe21d6dabbb281c Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 4 May 2022 16:05:04 +0900
Subject: [PATCH] sd-lldp: use memcpy_safe() as the buffer size may be zero
(cherry picked from commit 87bd4b79e692f384c2190c9b3824df4853333018)
---
src/libsystemd-network/lldp-neighbor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/libsystemd-network/lldp-neighbor.c b/src/libsystemd-network/lldp-neighbor.c
index 372bc2ef93..bc98235ce1 100644
--- a/src/libsystemd-network/lldp-neighbor.c
+++ b/src/libsystemd-network/lldp-neighbor.c
@@ -652,7 +652,8 @@ int sd_lldp_neighbor_from_raw(sd_lldp_neighbor **ret, const void *raw, size_t ra
if (!n)
return -ENOMEM;
- memcpy(LLDP_NEIGHBOR_RAW(n), raw, raw_size);
+ memcpy_safe(LLDP_NEIGHBOR_RAW(n), raw, raw_size);
+
r = lldp_neighbor_parse(n);
if (r < 0)
return r;
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化