Skip to content

Commit 657197e

Browse files
pks-tethomson
authored andcommitted
openssl: fix potential size overflow when writing data
Our `openssl_write` function calls `SSL_write` by passing in both `data` and `len` arguments directly. Thing is, our `len` parameter is of type `size_t` and theirs is of type `int`. We thus need to clamp our length to be at most `INT_MAX`.
1 parent 7613086 commit 657197e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/streams/openssl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,9 +649,8 @@ static ssize_t openssl_write(git_stream *stream, const char *data, size_t data_l
649649

650650
GIT_UNUSED(flags);
651651

652-
if ((ret = SSL_write(st->ssl, data, len)) <= 0) {
652+
if ((ret = SSL_write(st->ssl, data, len)) <= 0)
653653
return ssl_set_error(st->ssl, ret);
654-
}
655654

656655
return ret;
657656
}

0 commit comments

Comments
 (0)