From cad7eb2461e20d206436bd3968b0544d68f0640e Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Wed, 23 Jan 2019 14:06:04 +0100 Subject: [PATCH] Probably the strlcpy --- src/tools/getdns_query.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools/getdns_query.c b/src/tools/getdns_query.c index b3dca443..dc866586 100644 --- a/src/tools/getdns_query.c +++ b/src/tools/getdns_query.c @@ -657,12 +657,15 @@ getdns_return_t parse_args(int argc, char **argv) continue; } else if (arg[0] != '-') { + size_t arg_len = strlen(arg); + got_qname = 1; - if (strlen(arg) > sizeof(name)) { + if (arg_len > sizeof(name) - 1) { fprintf(stderr, "Query name too long\n"); return GETDNS_RETURN_BAD_DOMAIN_NAME; } - (void) strlcpy(name, arg, sizeof(name)); + (void) memcpy(name, arg, arg_len); + name[arg_len] = 0; continue; } for (c = arg+1; *c; c++) {