mirror of
https://0xacab.org/liberate/trees.git
synced 2024-11-22 10:10:39 +01:00
Use SSIZE_MAX in trees_ostream_send_chunk() check
The overflow check should use SSIZE_MAX since the function returns the chunk_size of size_t which in theory "could be" bigger but in practice very unlikely. Reported-by: Tomasz Miąsko <tomasz.miasko@gmail.com> Signed-off-by: David Goulet <dgoulet@riseup.net>
This commit is contained in:
parent
5a81de94f2
commit
619b7e463a
@ -85,7 +85,7 @@ trees_ostream_send_chunk(struct trees_ostream *sstream,
|
|||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
/* Extra protection here against overflow. Maybe too agressive! */
|
/* Extra protection here against overflow. Maybe too agressive! */
|
||||||
assert(chunk_size < (SIZE_MAX - crypto_box_SEALBYTES));
|
assert(chunk_size < (SSIZE_MAX - crypto_box_SEALBYTES));
|
||||||
size_t ciphertext_len = crypto_box_SEALBYTES + chunk_size;
|
size_t ciphertext_len = crypto_box_SEALBYTES + chunk_size;
|
||||||
unsigned char ciphertext[ciphertext_len];
|
unsigned char ciphertext[ciphertext_len];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user