diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2020-02-14 13:41:38 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2020-02-14 13:41:38 +0000 |
commit | 9ef37a77781e505f9aa55bedb769c8f7e1c76132 (patch) | |
tree | 0677346b11a9ee93213a090fe86ea48ba715fe52 /usr.bin/dig/host.c | |
parent | f94ccc0cc394bd5877d87adc936fc312f2ec3dfd (diff) |
Fix host(1) when providing a server to query.
host would use the name starting at the 2nd letter as the server argument.
Found the hard way by dhill.
While here restore previous behaviour of ignoring additional commands
after the server but use the server in that case.
Diffstat (limited to 'usr.bin/dig/host.c')
-rw-r--r-- | usr.bin/dig/host.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/dig/host.c b/usr.bin/dig/host.c index 66e41af9cf0..eeb91a5fc8b 100644 --- a/usr.bin/dig/host.c +++ b/usr.bin/dig/host.c @@ -775,10 +775,10 @@ parse_args(int argc, char **argv) { if (argc == 0) show_usage(); - strlcpy(hostname, *argv, sizeof(hostname)); + strlcpy(hostname, argv[0], sizeof(hostname)); - if (argc == 2) { - set_nameserver(*argv + 1); + if (argc >= 2) { + set_nameserver(argv[1]); debug("server is %s", *argv + 1); listed_server = ISC_TRUE; } else |