diff options
author | Matt Caswell <matt@openssl.org> | 2015-06-04 10:35:08 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-06-10 10:40:50 +0100 |
commit | b8b12aadd8edfd3bd327157c8899b1cf3403177f (patch) | |
tree | 2b8e5fb28fffb6b9049cae0934ddb28c38520346 /crypto | |
parent | 54e3ad003bdf83f189b2bf17fb998c028d39c8eb (diff) | |
download | openssl-b8b12aadd8edfd3bd327157c8899b1cf3403177f.tar.gz |
Change BIO_number_read and BIO_number_written() to be 64 bit
The return type of BIO_number_read() and BIO_number_written() as well as
the corresponding num_read and num_write members in the BIO structure has
been changed from unsigned long to uint64_t. On platforms where an unsigned
long is 32 bits (e.g. Windows) these counters could overflow if >4Gb is
transferred.
With thanks to the Open Crypto Audit Project for reporting this issue.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bio/bio_lib.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index cc859da740..6ab471cbcb 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -209,7 +209,7 @@ int BIO_read(BIO *b, void *out, int outl) i = b->method->bread(b, out, outl); if (i > 0) - b->num_read += (unsigned long)i; + b->num_read += (uint64_t)i; if (cb != NULL) i = (int)cb(b, BIO_CB_READ | BIO_CB_RETURN, out, outl, 0L, (long)i); @@ -242,7 +242,7 @@ int BIO_write(BIO *b, const void *in, int inl) i = b->method->bwrite(b, in, inl); if (i > 0) - b->num_write += (unsigned long)i; + b->num_write += (uint64_t)i; if (cb != NULL) i = (int)cb(b, BIO_CB_WRITE | BIO_CB_RETURN, in, inl, 0L, (long)i); @@ -272,7 +272,7 @@ int BIO_puts(BIO *b, const char *in) i = b->method->bputs(b, in); if (i > 0) - b->num_write += (unsigned long)i; + b->num_write += (uint64_t)i; if (cb != NULL) i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i); @@ -578,14 +578,14 @@ void *BIO_get_ex_data(BIO *bio, int idx) return (CRYPTO_get_ex_data(&(bio->ex_data), idx)); } -unsigned long BIO_number_read(BIO *bio) +uint64_t BIO_number_read(BIO *bio) { if (bio) return bio->num_read; return 0; } -unsigned long BIO_number_written(BIO *bio) +uint64_t BIO_number_written(BIO *bio) { if (bio) return bio->num_write; |