summaryrefslogtreecommitdiff
path: root/sftp.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2010-01-09 22:28:03 +1100
committerDarren Tucker <dtucker@zip.com.au>2010-01-09 22:28:03 +1100
commit70cc092817a61af78c751b8f7a8ac5dcabfeae00 (patch)
tree224c142521964990c93c54f3e073c43a6669fee0 /sftp.c
parent4b28251df4f1b653e7b3e015138c3da53a05bd58 (diff)
- dtucker@cvs.openbsd.org 2010/01/09 11:13:02
[sftp.c] Prevent sftp from derefing a null pointer when given a "-" without a command. Also, allow whitespace to follow a "-". bz#1691, path from Colin Watson via Debian. ok djm@ deraadt@
Diffstat (limited to 'sftp.c')
-rw-r--r--sftp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sftp.c b/sftp.c
index 9f5fa354d..78f8ca178 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp.c,v 1.117 2010/01/08 21:50:49 dtucker Exp $ */ 1/* $OpenBSD: sftp.c,v 1.118 2010/01/09 11:13:02 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -1112,17 +1112,18 @@ parse_args(const char **cpp, int *pflag, int *rflag, int *lflag, int *iflag,
1112 /* Skip leading whitespace */ 1112 /* Skip leading whitespace */
1113 cp = cp + strspn(cp, WHITESPACE); 1113 cp = cp + strspn(cp, WHITESPACE);
1114 1114
1115 /* Ignore blank lines and lines which begin with comment '#' char */
1116 if (*cp == '\0' || *cp == '#')
1117 return (0);
1118
1119 /* Check for leading '-' (disable error processing) */ 1115 /* Check for leading '-' (disable error processing) */
1120 *iflag = 0; 1116 *iflag = 0;
1121 if (*cp == '-') { 1117 if (*cp == '-') {
1122 *iflag = 1; 1118 *iflag = 1;
1123 cp++; 1119 cp++;
1120 cp = cp + strspn(cp, WHITESPACE);
1124 } 1121 }
1125 1122
1123 /* Ignore blank lines and lines which begin with comment '#' char */
1124 if (*cp == '\0' || *cp == '#')
1125 return (0);
1126
1126 if ((argv = makeargv(cp, &argc, 0, NULL, NULL)) == NULL) 1127 if ((argv = makeargv(cp, &argc, 0, NULL, NULL)) == NULL)
1127 return -1; 1128 return -1;
1128 1129