aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-02-17 21:47:30 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-02-17 21:48:05 +0100
commitdf42bcdbfebefc908dab7780e931d9ae9ead9d89 (patch)
treeb7c0483ecb1300bd8a4b571376f5b7ba3b5a5368
parentf87e8f53920adfa80a3f4af9435370dc272c3783 (diff)
parentc801c82e253dc4956069b6110f65b43f538dd5a1 (diff)
downloadbitcoin-df42bcdbfebefc908dab7780e931d9ae9ead9d89.tar.xz
Merge #9785: Avoid variable length arrays
c801c82 Move BIP70_MAX_PAYMENTREQUEST_SIZE to header (Pieter Wuille) 914fad1 Make KEY_SIZE a compile-time constant (Pieter Wuille)
-rw-r--r--src/httprpc.cpp2
-rw-r--r--src/qt/paymentserver.cpp2
-rw-r--r--src/qt/paymentserver.h2
3 files changed, 2 insertions, 4 deletions
diff --git a/src/httprpc.cpp b/src/httprpc.cpp
index daac7a0f1a..8ac6925acd 100644
--- a/src/httprpc.cpp
+++ b/src/httprpc.cpp
@@ -112,7 +112,7 @@ static bool multiUserAuthorized(std::string strUserPass)
std::string strSalt = vFields[1];
std::string strHash = vFields[2];
- unsigned int KEY_SIZE = 32;
+ static const unsigned int KEY_SIZE = 32;
unsigned char out[KEY_SIZE];
CHMAC_SHA256(reinterpret_cast<const unsigned char*>(strSalt.c_str()), strSalt.size()).Write(reinterpret_cast<const unsigned char*>(strPass.c_str()), strPass.size()).Finalize(out);
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index 688e8123af..dd75f12076 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -55,8 +55,6 @@ const char* BIP70_MESSAGE_PAYMENTREQUEST = "PaymentRequest";
const char* BIP71_MIMETYPE_PAYMENT = "application/bitcoin-payment";
const char* BIP71_MIMETYPE_PAYMENTACK = "application/bitcoin-paymentack";
const char* BIP71_MIMETYPE_PAYMENTREQUEST = "application/bitcoin-paymentrequest";
-// BIP70 max payment request size in bytes (DoS protection)
-const qint64 BIP70_MAX_PAYMENTREQUEST_SIZE = 50000;
struct X509StoreDeleter {
void operator()(X509_STORE* b) {
diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h
index 9d46280a37..7c6d4507fe 100644
--- a/src/qt/paymentserver.h
+++ b/src/qt/paymentserver.h
@@ -53,7 +53,7 @@ class QUrl;
QT_END_NAMESPACE
// BIP70 max payment request size in bytes (DoS protection)
-extern const qint64 BIP70_MAX_PAYMENTREQUEST_SIZE;
+static const qint64 BIP70_MAX_PAYMENTREQUEST_SIZE = 50000;
class PaymentServer : public QObject
{