From a46f311762825197cfa2f1764e58de0e0e7188e5 Mon Sep 17 00:00:00 2001 From: Meeh Date: Sun, 2 Feb 2014 23:22:00 +0100 Subject: [PATCH 1/2] RouterInfo file size fix --- RouterInfo.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RouterInfo.cpp b/RouterInfo.cpp index 44bd90e4..1d6eb6d5 100644 --- a/RouterInfo.cpp +++ b/RouterInfo.cpp @@ -46,7 +46,11 @@ namespace data if (s.is_open ()) { s.seekg (0,std::ios::end); - m_BufferLen = s.tellg (); + m_BufferLen = s.tellg (); + if (m_BufferLen < 40) + { + LogPrint("File", filename, " is malformed"); + } s.seekg(0, std::ios::beg); s.read(m_Buffer,m_BufferLen); ReadFromBuffer (); From 1efe9cc41ecfa5d3075091c283bf9b1c58e706b2 Mon Sep 17 00:00:00 2001 From: Meeh Date: Sun, 2 Feb 2014 23:23:15 +0100 Subject: [PATCH 2/2] return --- RouterInfo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/RouterInfo.cpp b/RouterInfo.cpp index 1d6eb6d5..3b0054a0 100644 --- a/RouterInfo.cpp +++ b/RouterInfo.cpp @@ -50,6 +50,7 @@ namespace data if (m_BufferLen < 40) { LogPrint("File", filename, " is malformed"); + return; } s.seekg(0, std::ios::beg); s.read(m_Buffer,m_BufferLen);