Index: client/settings.cc |
diff --git a/client/settings.cc b/client/settings.cc |
index b4e5f434b44e12a60e85a46665c585d0774d7df9..aa2c4f8f21ac9d52ab5c78de9fb6467a9e97d174 100644 |
--- a/client/settings.cc |
+++ b/client/settings.cc |
@@ -28,19 +28,24 @@ |
namespace crashpad { |
struct ALIGNAS(4) Settings::Data { |
- static const uint16_t kSettingsVersion = 1; |
+ static const uint32_t kSettingsMagic = 'CPds'; |
+ static const uint32_t kSettingsVersion = 1; |
enum Options : uint32_t { |
kUploadsEnabled = 1 << 0, |
}; |
- Data() : version(kSettingsVersion), |
+ Data() : magic(kSettingsMagic), |
+ version(kSettingsVersion), |
options(0), |
+ padding_0(0), |
last_upload_attempt_time(0), |
client_id() {} |
+ uint32_t magic; |
uint32_t version; |
uint32_t options; |
+ uint32_t padding_0; |
uint64_t last_upload_attempt_time; // time_t |
UUID client_id; |
}; |
@@ -193,6 +198,11 @@ bool Settings::ReadSettings(FileHandle handle, Data* out_data) { |
if (!LoggingReadFile(handle, out_data, sizeof(*out_data))) |
return false; |
+ if (out_data->magic != Data::kSettingsMagic) { |
+ LOG(ERROR) << "Settings magic is not " << Data::kSettingsMagic; |
+ return false; |
+ } |
+ |
Robert Sesek
2015/03/12 23:26:48
Should we also ensure the padding is 0?
|
if (out_data->version != Data::kSettingsVersion) { |
LOG(ERROR) << "Settings version is not " << Data::kSettingsVersion; |
return false; |