Skip to content

Commit 5e59642

Browse files
laanwjcodablock
authored andcommitted
Merge bitcoin#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)
1 parent 054abdb commit 5e59642

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

src/httprpc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static bool multiUserAuthorized(std::string strUserPass)
112112
std::string strSalt = vFields[1];
113113
std::string strHash = vFields[2];
114114

115-
unsigned int KEY_SIZE = 32;
115+
static const unsigned int KEY_SIZE = 32;
116116
unsigned char out[KEY_SIZE];
117117

118118
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);

src/qt/paymentserver.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ const char* BIP70_MESSAGE_PAYMENTREQUEST = "PaymentRequest";
5656
const char* BIP71_MIMETYPE_PAYMENT = "application/dash-payment";
5757
const char* BIP71_MIMETYPE_PAYMENTACK = "application/dash-paymentack";
5858
const char* BIP71_MIMETYPE_PAYMENTREQUEST = "application/dash-paymentrequest";
59-
// BIP70 max payment request size in bytes (DoS protection)
60-
const qint64 BIP70_MAX_PAYMENTREQUEST_SIZE = 50000;
6159

6260
struct X509StoreDeleter {
6361
void operator()(X509_STORE* b) {

src/qt/paymentserver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class QUrl;
5353
QT_END_NAMESPACE
5454

5555
// BIP70 max payment request size in bytes (DoS protection)
56-
extern const qint64 BIP70_MAX_PAYMENTREQUEST_SIZE;
56+
static const qint64 BIP70_MAX_PAYMENTREQUEST_SIZE = 50000;
5757

5858
class PaymentServer : public QObject
5959
{

0 commit comments

Comments
 (0)