diff options
author | Etienne Samson <samson.etienne@gmail.com> | 2016-12-21 21:24:33 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2017-01-06 17:17:15 +0000 |
commit | b5c6a1b407b7f8b952bded2789593b68b1876211 (patch) | |
tree | 68cbc25627429ff115314a8056b3b5fd5d81343a | |
parent | 428e18f8d4765b8ad6cf4022080a81ab16f6fdc4 (diff) | |
download | libgit2-b5c6a1b407b7f8b952bded2789593b68b1876211.tar.gz |
http: check certificate validity before clobbering the error variable
-rw-r--r-- | src/transports/http.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/transports/http.c b/src/transports/http.c index f0efd956a..b4418f69a 100644 --- a/src/transports/http.c +++ b/src/transports/http.c @@ -602,13 +602,12 @@ static int http_connect(http_subtransport *t) if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL && git_stream_is_encrypted(t->io)) { git_cert *cert; - int is_valid; + int is_valid = (error == GIT_OK); if ((error = git_stream_certificate(&cert, t->io)) < 0) return error; giterr_clear(); - is_valid = error != GIT_ECERTIFICATE; error = t->owner->certificate_check_cb(cert, is_valid, t->connection_data.host, t->owner->message_cb_payload); if (error < 0) { |