diff options
author | 2019-11-17 17:38:33 +0000 | |
---|---|---|
committer | 2019-11-17 17:38:33 +0000 | |
commit | 572ca008c26b4fb9f0d3267bd6a116efc6152bf8 (patch) | |
tree | b700f144d804f7fdc71a20e3f60f13835942d0a6 | |
parent | Provide framework for sending alerts and post-handshake handshake messages. (diff) | |
download | wireguard-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.c | 12 |
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 |