diff options
author | Darren Tucker <dtucker@zip.com.au> | 2010-01-08 18:53:43 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2010-01-08 18:53:43 +1100 |
commit | b8c884a0ba4050e4267be786414127c0f09d5544 (patch) | |
tree | 18b20493bb52430d446f913e608968eb00dd49d3 /ssh.c | |
parent | 57e0d01260d3c1c7bf9366eed58c54a96eedbc81 (diff) |
- guenther@cvs.openbsd.org 2009/12/20 07:28:36
[ssh.c sftp.c scp.c]
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 'ssh.c')
-rw-r--r-- | ssh.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.328 2009/10/28 16:38:18 reyk Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.329 2009/12/20 07:28:36 guenther Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -528,7 +528,7 @@ main(int ac, char **av) | |||
528 | ac -= optind; | 528 | ac -= optind; |
529 | av += optind; | 529 | av += optind; |
530 | 530 | ||
531 | if (ac > 0 && !host && **av != '-') { | 531 | if (ac > 0 && !host) { |
532 | if (strrchr(*av, '@')) { | 532 | if (strrchr(*av, '@')) { |
533 | p = xstrdup(*av); | 533 | p = xstrdup(*av); |
534 | cp = strrchr(p, '@'); | 534 | cp = strrchr(p, '@'); |