summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-11-17 17:38:33 +0000
committerderaadt <deraadt@openbsd.org>2019-11-17 17:38:33 +0000
commit572ca008c26b4fb9f0d3267bd6a116efc6152bf8 (patch)
treeb700f144d804f7fdc71a20e3f60f13835942d0a6
parentProvide framework for sending alerts and post-handshake handshake messages. (diff)
downloadwireguard-openbsd-572ca008c26b4fb9f0d3267bd6a116efc6152bf8.tar.xz
wireguard-openbsd-572ca008c26b4fb9f0d3267bd6a116efc6152bf8.zip
fail to usage if extra argv are present
noticed by jsing and beck, ok tedu
-rw-r--r--usr.bin/nc/netcat.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index 1dc95e9f360..051daf18118 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.211 2019/11/13 04:10:38 beck Exp $ */
+/* $OpenBSD: netcat.c,v 1.212 2019/11/17 17:38:33 deraadt Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
* Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -352,15 +352,11 @@ main(int argc, char *argv[])
err(1, "setrtable");
/* Cruft to make sure options are clean, and used properly. */
- if (argv[0] && !argv[1] && family == AF_UNIX) {
+ if (argc == 1 && family == AF_UNIX) {
host = argv[0];
- uport = NULL;
- } else if (argv[0] && !argv[1]) {
- if (!lflag)
- usage(1);
+ } else if (argc == 1 && lflag) {
uport = argv[0];
- host = NULL;
- } else if (argv[0] && argv[1]) {
+ } else if (argc == 2) {
host = argv[0];
uport = argv[1];
} else