summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-12-01 17:11:07 +0100
committerThomas Haller <thaller@redhat.com>2023-12-01 17:13:37 +0100
commit65ab16f23b553ba09b168a961a0b77de341f470d (patch)
tree56a590e32ce861b1f11687d86ae5dfa34bbad9c9
parent444e2c04fec45d97775ceff06504b50b8a9bd79e (diff)
downloadlibnl-65ab16f23b553ba09b168a961a0b77de341f470d.tar.gz
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);
-rw-r--r--include/base/nl-base-utils.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/base/nl-base-utils.h b/include/base/nl-base-utils.h
index 6dd9c49f..11986e93 100644
--- a/include/base/nl-base-utils.h
+++ b/include/base/nl-base-utils.h
@@ -680,8 +680,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;