9 Star 0 Fork 17

src-openEuler / libnl3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-do-not-use-static-array-indices-for-buffer.patch 1.65 KB
一键复制 编辑 原始数据 按行查看 历史
sun_hai 提交于 2024-04-25 21:26 . sync some pathes from upstream
From 65ab16f23b553ba09b168a961a0b77de341f470d Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 1 Dec 2023 17:11:07 +0100
Subject: [PATCH] base: don't use static array indices for buffer argument of _nl_inet_ntop()
Seems the static array indices can confuse coverity. I think coverity is wrong
here, regardless, change it.
libnl-3.8.0/include/base/nl-base-utils.h:683: overrun-buffer-arg: Overrunning buffer pointed to by "buf" of 16 bytes by passing it to a function which accesses it at byte offset 45 using argument "(addr_family == 2) ? 16 : 46" (which evaluates to 46).
# 681| * and a suitably large buffer, it cannot. Assert for that. */
# 682|
# 683|-> r = (char *)inet_ntop(addr_family, addr, buf,
# 684| (addr_family == AF_INET) ? INET_ADDRSTRLEN :
# 685| INET6_ADDRSTRLEN);
---
Conflict:Before libnl3.8 is reconstructed, the _nl_inet_ntop function is in utils.h. Therefore, the incorporated patch is different from the 65ab16f modification file.
Reference:https://github.com/thom311/libnl/commit/65ab16f23b553ba09b168a961a0b77de341f470d
include/netlink-private/utils.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/netlink-private/utils.h b/include/netlink-private/utils.h
index 93a04c9..5540144 100644
--- a/include/netlink-private/utils.h
+++ b/include/netlink-private/utils.h
@@ -361,8 +361,7 @@ typedef union {
struct in6_addr a6;
} _NLIPAddr;
-static inline char *_nl_inet_ntop(int addr_family, const void *addr,
- char buf[static INET_ADDRSTRLEN])
+static inline char *_nl_inet_ntop(int addr_family, const void *addr, char *buf)
{
char *r;
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/libnl3.git
git@gitee.com:src-openeuler/libnl3.git
src-openeuler
libnl3
libnl3
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891