summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2016-12-21 21:24:33 +0100
committerEdward Thomson <ethomson@github.com>2017-01-09 14:04:32 -0500
commitddcf37abfff55c6e09ca16c7e83584aeec4f49c8 (patch)
tree5b445e384cc744a369f31d00e0ed9344db489e16
parent785d8c48ea8725691da3c50e7dae8751523d4c30 (diff)
downloadlibgit2-ddcf37abfff55c6e09ca16c7e83584aeec4f49c8.tar.gz
http: check certificate validity before clobbering the error variable
-rw-r--r--src/transports/http.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/transports/http.c b/src/transports/http.c
index 88b124bf7..94e28bd4b 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -601,13 +601,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) {