Probably the strlcpy

This commit is contained in:
Willem Toorop 2019-01-23 14:06:04 +01:00
parent f72fe60035
commit cad7eb2461
1 changed files with 5 additions and 2 deletions

View File

@ -657,12 +657,15 @@ getdns_return_t parse_args(int argc, char **argv)
continue; continue;
} else if (arg[0] != '-') { } else if (arg[0] != '-') {
size_t arg_len = strlen(arg);
got_qname = 1; got_qname = 1;
if (strlen(arg) > sizeof(name)) { if (arg_len > sizeof(name) - 1) {
fprintf(stderr, "Query name too long\n"); fprintf(stderr, "Query name too long\n");
return GETDNS_RETURN_BAD_DOMAIN_NAME; return GETDNS_RETURN_BAD_DOMAIN_NAME;
} }
(void) strlcpy(name, arg, sizeof(name)); (void) memcpy(name, arg, arg_len);
name[arg_len] = 0;
continue; continue;
} }
for (c = arg+1; *c; c++) { for (c = arg+1; *c; c++) {