Fix an overflow validation

The transition from assert() to if() used the wrong comparaison making
the plugin to not work.

Fixes #10

Signed-off-by: David Goulet <dgoulet@riseup.net>
This commit is contained in:
David Goulet 2017-03-17 12:35:25 -04:00
parent 006059c8a4
commit 146993d0f4
No known key found for this signature in database
GPG Key ID: 42E86A2A11F48D36

View File

@ -87,7 +87,7 @@ trees_ostream_send_chunk(struct trees_ostream *sstream,
unsigned char ciphertext[ciphertext_len]; unsigned char ciphertext[ciphertext_len];
/* Extra protection here against overflow. */ /* Extra protection here against overflow. */
if (chunk_size < (SSIZE_MAX - crypto_box_SEALBYTES)) { if (chunk_size >= (SSIZE_MAX - crypto_box_SEALBYTES)) {
sstream->ostream.ostream.stream_errno = EIO; sstream->ostream.ostream.stream_errno = EIO;
goto err; goto err;
} }