Skip to content

Commit

Permalink
http: check certificate validity before clobbering the error variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tiennou authored and Edward Thomson committed Jan 6, 2017
1 parent 75db289 commit 9a64e62
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/transports/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,13 +624,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) {
Expand Down

0 comments on commit 9a64e62

Please sign in to comment.