aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-01-13 14:36:42 -0500
committerRiccardo Spagni <ric@spagni.net>2017-01-13 14:36:42 -0500
commitcbb39b499bdadb79619c0c0b11ecd28420e8d8cc (patch)
tree826f4088e12dbb0c718c4d93f5c1112e0fa11654 /src/cryptonote_core
parentMerge pull request #1555 (diff)
parentinitialize timestamp to 0 and check for mktime() error (diff)
downloadmonero-cbb39b499bdadb79619c0c0b11ecd28420e8d8cc.tar.xz
Merge pull request #1558
7961878e initialize timestamp to 0 and check for mktime() error (Chris Vickio)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/account.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cryptonote_core/account.cpp b/src/cryptonote_core/account.cpp
index 89ad4184c..602561489 100644
--- a/src/cryptonote_core/account.cpp
+++ b/src/cryptonote_core/account.cpp
@@ -72,7 +72,7 @@ DISABLE_VS_WARNINGS(4244 4345)
generate_keys(m_keys.m_account_address.m_view_public_key, m_keys.m_view_secret_key, second, two_random ? false : true);
- struct tm timestamp;
+ struct tm timestamp = {0};
timestamp.tm_year = 2014 - 1900; // year 2014
timestamp.tm_mon = 6 - 1; // month june
timestamp.tm_mday = 8; // 8th of june
@@ -82,7 +82,7 @@ DISABLE_VS_WARNINGS(4244 4345)
if (recover)
{
- m_creation_timestamp = mktime(&timestamp);
+ m_creation_timestamp = std::max(mktime(&timestamp), (long)0);
}
else
{
@@ -97,7 +97,7 @@ DISABLE_VS_WARNINGS(4244 4345)
m_keys.m_spend_secret_key = spendkey;
m_keys.m_view_secret_key = viewkey;
- struct tm timestamp;
+ struct tm timestamp = {0};
timestamp.tm_year = 2014 - 1900; // year 2014
timestamp.tm_mon = 4 - 1; // month april
timestamp.tm_mday = 15; // 15th of april
@@ -105,7 +105,7 @@ DISABLE_VS_WARNINGS(4244 4345)
timestamp.tm_min = 0;
timestamp.tm_sec = 0;
- m_creation_timestamp = mktime(&timestamp);
+ m_creation_timestamp = std::max(mktime(&timestamp), (long)0);
}
//-----------------------------------------------------------------
void account_base::create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey)