aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-08-27 19:10:41 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2012-08-27 19:10:41 +0000
commitd31e24aeaaf18a4117f23a937614a8bf2679e8a4 (patch)
tree30852ed3e4aa86d63deef2c47d9090866381dcfa /src/main.cpp
parente1c2163fb7b3f37932be9093cadd6cce250844a5 (diff)
parentb9b15578bb52a7a7394fd1ef497f186c5c950cb1 (diff)
downloadbitcoin-d31e24aeaaf18a4117f23a937614a8bf2679e8a4.tar.xz
Merge branch '0.4.x' into 0.5.x
Conflicts: contrib/Bitcoin.app/Contents/Info.plist doc/README doc/README_windows.txt share/setup.nsi src/serialize.h
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index cd9c8e5e49..b7d2398e95 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1994,6 +1994,28 @@ bool CAlert::ProcessAlert()
if (!IsInEffect())
return false;
+ // alert.nID=max is reserved for if the alert key is
+ // compromised. It must have a pre-defined message,
+ // must never expire, must apply to all versions,
+ // and must cancel all previous
+ // alerts or it will be ignored (so an attacker can't
+ // send an "everything is OK, don't panic" version that
+ // cannot be overridden):
+ int maxInt = std::numeric_limits<int>::max();
+ if (nID == maxInt)
+ {
+ if (!(
+ nExpiration == maxInt &&
+ nCancel == (maxInt-1) &&
+ nMinVer == 0 &&
+ nMaxVer == maxInt &&
+ setSubVer.empty() &&
+ nPriority == maxInt &&
+ strStatusBar == "URGENT: Alert key compromised, upgrade required"
+ ))
+ return false;
+ }
+
CRITICAL_BLOCK(cs_mapAlerts)
{
// Cancel previous alerts