Skip to content

Commit 9a64e62

Browse files
tiennouEdward Thomson
authored andcommitted
http: check certificate validity before clobbering the error variable
1 parent 75db289 commit 9a64e62

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/transports/http.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,13 +624,12 @@ static int http_connect(http_subtransport *t)
624624
if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL &&
625625
git_stream_is_encrypted(t->io)) {
626626
git_cert *cert;
627-
int is_valid;
627+
int is_valid = (error == GIT_OK);
628628

629629
if ((error = git_stream_certificate(&cert, t->io)) < 0)
630630
return error;
631631

632632
giterr_clear();
633-
is_valid = error != GIT_ECERTIFICATE;
634633
error = t->owner->certificate_check_cb(cert, is_valid, t->connection_data.host, t->owner->message_cb_payload);
635634

636635
if (error < 0) {

0 commit comments

Comments
 (0)