|
|
08c8fc |
commit d8106bbb5348591968722e14fe4ee4b81e7902aa
|
|
|
08c8fc |
Author: David Howells <dhowells@redhat.com>
|
|
|
08c8fc |
Date: Wed Jun 16 15:06:36 2021 +0100
|
|
|
08c8fc |
|
|
|
08c8fc |
Fix issue found by Coverity
|
|
|
08c8fc |
|
|
|
08c8fc |
This isn't something that can actually be triggered. The port parameter is
|
|
|
08c8fc |
always NULL, so just drop the parameter and the call to strcat().
|
|
|
08c8fc |
|
|
|
08c8fc |
Error: STRING_OVERFLOW (CWE-120):
|
|
|
08c8fc |
keyutils-1.5.10/key.dns_resolver.c:388: fixed_size_dest: You might overrun the 55-character fixed-size string "buf" by copying "port" without checking the length.
|
|
|
08c8fc |
keyutils-1.5.10/key.dns_resolver.c:388: parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
|
|
|
08c8fc |
|
|
|
08c8fc |
Signed-off-by: David Howells <dhowells@redhat.com>
|
|
|
08c8fc |
---
|
|
|
08c8fc |
key.dns_resolver.c | 8 +++-----
|
|
|
08c8fc |
1 file changed, 3 insertions(+), 5 deletions(-)
|
|
|
08c8fc |
|
|
|
08c8fc |
diff --git a/key.dns_resolver.c b/key.dns_resolver.c
|
|
|
08c8fc |
index f3052e6..2743119 100644
|
|
|
08c8fc |
--- a/key.dns_resolver.c
|
|
|
08c8fc |
+++ b/key.dns_resolver.c
|
|
|
08c8fc |
@@ -332,7 +332,7 @@ static void dump_payload(void)
|
|
|
08c8fc |
* string to the list of payload segments.
|
|
|
08c8fc |
*/
|
|
|
08c8fc |
static int
|
|
|
08c8fc |
-dns_resolver(const char *server_name, const char *port)
|
|
|
08c8fc |
+dns_resolver(const char *server_name)
|
|
|
08c8fc |
{
|
|
|
08c8fc |
struct addrinfo hints, *addr, *ai;
|
|
|
08c8fc |
char buf[INET6_ADDRSTRLEN + 8 + 1];
|
|
|
08c8fc |
@@ -384,8 +384,6 @@ dns_resolver(const char *server_name, const char *port)
|
|
|
08c8fc |
if (!inet_ntop(ai->ai_family, sa, buf, len))
|
|
|
08c8fc |
error("%s: inet_ntop: %m", __func__);
|
|
|
08c8fc |
|
|
|
08c8fc |
- if (port)
|
|
|
08c8fc |
- strcat(buf, port);
|
|
|
08c8fc |
append_address_to_payload(buf);
|
|
|
08c8fc |
if (mask & ONE_ADDR_ONLY)
|
|
|
08c8fc |
break;
|
|
|
08c8fc |
@@ -449,7 +447,7 @@ static void afsdb_hosts_to_addrs(ns_msg handle,
|
|
|
08c8fc |
goto next_one;
|
|
|
08c8fc |
|
|
|
08c8fc |
/* Turn the hostname into IP addresses */
|
|
|
08c8fc |
- ret = dns_resolver(vllist[vlsnum], NULL);
|
|
|
08c8fc |
+ ret = dns_resolver(vllist[vlsnum]);
|
|
|
08c8fc |
if (ret) {
|
|
|
08c8fc |
debug("AFSDB RR can't resolve."
|
|
|
08c8fc |
"subtype:%d, server name:%s, netmask:%u",
|
|
|
08c8fc |
@@ -604,7 +602,7 @@ int dns_query_a_or_aaaa(const char *hostname, char *options)
|
|
|
08c8fc |
}
|
|
|
08c8fc |
|
|
|
08c8fc |
/* Turn the hostname into IP addresses */
|
|
|
08c8fc |
- ret = dns_resolver(hostname, NULL);
|
|
|
08c8fc |
+ ret = dns_resolver(hostname);
|
|
|
08c8fc |
if (ret)
|
|
|
08c8fc |
nsError(NO_DATA, hostname);
|
|
|
08c8fc |
|