diff options
author | Thomas Haller <thaller@redhat.com> | 2023-12-01 16:11:07 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-12-01 16:13:37 (GMT) |
commit | 65ab16f23b553ba09b168a961a0b77de341f470d (patch) | |
tree | 56a590e32ce861b1f11687d86ae5dfa34bbad9c9 /include | |
parent | 444e2c04fec45d97775ceff06504b50b8a9bd79e (diff) | |
download | libnl-65ab16f23b553ba09b168a961a0b77de341f470d.zip libnl-65ab16f23b553ba09b168a961a0b77de341f470d.tar.gz libnl-65ab16f23b553ba09b168a961a0b77de341f470d.tar.bz2 |
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);
Diffstat (limited to 'include')
-rw-r--r-- | include/base/nl-base-utils.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/include/base/nl-base-utils.h b/include/base/nl-base-utils.h index 6dd9c49..11986e9 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; |