summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-04-11 00:30:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-17 00:48:00 (GMT)
commit22e5ae5c8e6859e5670a2c6bbf5798778373144c (patch)
tree5a6dad8f1db78298d29162cc2fc4e3d3e6b3fb56 /connect.c
parent486c8e8c6a42a1e0537eedb2b5ab9e74eb58d5f7 (diff)
downloadgit-22e5ae5c8e6859e5670a2c6bbf5798778373144c.zip
git-22e5ae5c8e6859e5670a2c6bbf5798778373144c.tar.gz
git-22e5ae5c8e6859e5670a2c6bbf5798778373144c.tar.bz2
connect.c: handle errors from split_cmdline
Commit e9d9a8a4d (connect: handle putty/plink also in GIT_SSH_COMMAND, 2017-01-02) added a call to split_cmdline(), but checks only for a non-zero return to see if we got any output. Since the function returns negative values (and a NULL argv) on error, we end up dereferencing NULL and segfaulting. Arguably we could report on the parsing error here, but it's probably not worth it. This is a best-effort attempt to see if we are using plink. So we can simply return here with "no, it wasn't plink" and let the shell actually complain about the bogus quoting. Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/connect.c b/connect.c
index 7d65c1c..6f2281a 100644
--- a/connect.c
+++ b/connect.c
@@ -730,7 +730,7 @@ static void handle_ssh_variant(const char *ssh_command, int is_cmdline,
const char **ssh_argv;
p = xstrdup(ssh_command);
- if (split_cmdline(p, &ssh_argv)) {
+ if (split_cmdline(p, &ssh_argv) > 0) {
variant = basename((char *)ssh_argv[0]);
/*
* At this point, variant points into the buffer