aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-06-27 00:50:56 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-07-02 21:33:29 +0200
commit21ee1eb2de40c8377de22a9ff7e65663f245a61c (patch)
tree328d1e33c08f5fc1d95c0896ef258c5e2d973472
parent1ee2ecade3f41e2a3e51c1e580b08cba977a7c8d (diff)
downloadpasst-21ee1eb2de40c8377de22a9ff7e65663f245a61c.tar
passt-21ee1eb2de40c8377de22a9ff7e65663f245a61c.tar.gz
passt-21ee1eb2de40c8377de22a9ff7e65663f245a61c.tar.bz2
passt-21ee1eb2de40c8377de22a9ff7e65663f245a61c.tar.lz
passt-21ee1eb2de40c8377de22a9ff7e65663f245a61c.tar.xz
passt-21ee1eb2de40c8377de22a9ff7e65663f245a61c.tar.zst
passt-21ee1eb2de40c8377de22a9ff7e65663f245a61c.zip
conf: Copy up to MAXDNSRCH - 1 bytes, not MAXDNSRCH
Spotted by Coverity just recently. Not that it really matters as MAXDNSRCH always appears to be defined as 1025, while a full domain name can have up to 253 characters: it would be a bit pointless to have a longer search domain. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--conf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/conf.c b/conf.c
index e1f5422..9e47e9a 100644
--- a/conf.c
+++ b/conf.c
@@ -453,7 +453,7 @@ static void get_dns(struct ctx *c)
while (s - c->dns_search < ARRAY_SIZE(c->dns_search) - 1
/* cppcheck-suppress strtokCalled */
&& (p = strtok(NULL, " \t"))) {
- strncpy(s->n, p, sizeof(c->dns_search[0]));
+ strncpy(s->n, p, sizeof(c->dns_search[0]) - 1);
s++;
*s->n = 0;
}