40 lines
1.7 KiB
Diff
40 lines
1.7 KiB
Diff
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
|
|
|