summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2009-12-20 07:28:36 +0000
committerguenther <guenther@openbsd.org>2009-12-20 07:28:36 +0000
commit3406bb594f7891d9be60d8bd76e7e93f50bea0de (patch)
treeb219560b2af896c80d3baff355f5115bda72e4ba /usr.bin/ssh/ssh.c
parentImplement proper error handling for getgrent(3), getgrnam(3) and getgrgid(3). (diff)
downloadwireguard-openbsd-3406bb594f7891d9be60d8bd76e7e93f50bea0de.tar.xz
wireguard-openbsd-3406bb594f7891d9be60d8bd76e7e93f50bea0de.zip
When passing user-controlled options with arguments to other programs,
pass the option and option argument as separate argv entries and not smashed into one (e.g., as -l foo and not -lfoo). Also, always pass a "--" argument to stop option parsing, so that a positional argument that starts with a '-' isn't treated as an option. This fixes some error cases as well as the handling of hostnames and filenames that start with a '-'. Based on a diff by halex@ ok halex@ djm@ deraadt@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r--usr.bin/ssh/ssh.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 80ac30d4558..b3e3e1c0b88 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.328 2009/10/28 16:38:18 reyk Exp $ */
+/* $OpenBSD: ssh.c,v 1.329 2009/12/20 07:28:36 guenther Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -515,7 +515,7 @@ main(int ac, char **av)
ac -= optind;
av += optind;
- if (ac > 0 && !host && **av != '-') {
+ if (ac > 0 && !host) {
if (strrchr(*av, '@')) {
p = xstrdup(*av);
cp = strrchr(p, '@');