Dňa 18.11.2011 13:13, Alexander Lamaison wrote / napísal(a):
You're quite right, the code isn't treating ext as an optional
argument. Please create your patch using 'git format-patch' so we
The patch was created using `git format-patch` and then sent using `git
send-email`.
We normaly use `git am` on the eml message file from mailing lists to
apply patches send using email. Sorry for the inconvinience.
You can find the pre-`git send-email` file as attachment to this message.
Peter
have all the metadata (mainly your authorship).
Alex
--
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
From 3233e80f07c5fd8a548332f6014157634d1c2beb Mon Sep 17 00:00:00 2001
Message-Id:
<3233e80f07c5fd8a548332f6014157634d1c2beb.1321631261.git.pkre...@redhat.com>
From: Peter Krempa <pkre...@redhat.com>
Date: Tue, 15 Nov 2011 11:14:39 +0100
Subject: [PATCH] knownhost_check(): Don't dereference ext if NULL is passed
Documentation for libssh2_knownhost_checkp() and related functions
states that the last argument is filled with data if non-NULL.
"knownhost if set to non-NULL, it must be a pointer to a 'struct
libssh2_knownhost' pointer that gets filled in to point to info about a
known host that matches or partially matches."
In this function ext is dereferenced even if set to NULL, causing
segfault in applications not needing the extra data.
---
src/knownhost.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/knownhost.c b/src/knownhost.c
index d90f1d4..193bda3 100644
--- a/src/knownhost.c
+++ b/src/knownhost.c
@@ -417,7 +417,8 @@ knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
/* host name match, now compare the keys */
if(!strcmp(key, node->key)) {
/* they match! */
- *ext = knownhost_to_external(node);
+ if (ext)
+ *ext = knownhost_to_external(node);
badkey = NULL;
rc = LIBSSH2_KNOWNHOST_CHECK_MATCH;
break;
@@ -438,7 +439,8 @@ knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
if(badkey) {
/* key mismatch */
- *ext = knownhost_to_external(badkey);
+ if (ext)
+ *ext = knownhost_to_external(badkey);
rc = LIBSSH2_KNOWNHOST_CHECK_MISMATCH;
}
--
1.7.6.1
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel