diff options
| author | Pieter Wuille <[email protected]> | 2012-02-18 13:32:25 +0100 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2012-02-18 13:32:25 +0100 |
| commit | a06113b0c5aaa5f34b437bb1ee279dfdc9d870ea (patch) | |
| tree | 96cb5266b2c423739e2c706de81e0eee09b348b1 /src | |
| parent | don't allow -daemon in bitcoin-qt (changes only #defines) (diff) | |
| download | discoin-a06113b0c5aaa5f34b437bb1ee279dfdc9d870ea.tar.xz discoin-a06113b0c5aaa5f34b437bb1ee279dfdc9d870ea.zip | |
Workaround for BN_bn2mpi reading/writing out of bounds
When OpenSSL's BN_bn2mpi is passed a buffer of size 4, valgrind
reports reading/writing one byte past it. I am unable to find
evidence of this behaviour in BN_bn2mpi's source code, so it may
be a spurious warning. However, this change is harmless, as only
the bignum with value 0 results in an mpi serialization of size 4.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bignum.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bignum.h b/src/bignum.h index 4143f6003..a750025f3 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -243,7 +243,7 @@ public: std::vector<unsigned char> getvch() const { unsigned int nSize = BN_bn2mpi(this, NULL); - if (nSize < 4) + if (nSize <= 4) return std::vector<unsigned char>(); std::vector<unsigned char> vch(nSize); BN_bn2mpi(this, &vch[0]); |