flashtool: make CFlashVersionInfo robust against invalid input

Origin commit data
------------------
Branch: ni/coolstream
Commit: 4134af3d1d
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2017-02-04 (Sat, 04 Feb 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2017-02-04 12:12:27 +01:00
committed by Michael Liebmann
parent 7772bf165e
commit 5e76b3eef8

View File

@@ -441,10 +441,14 @@ void CFlashTool::reboot()
}
//-----------------------------------------------------------------------------------------------------------------
CFlashVersionInfo::CFlashVersionInfo(const std::string & versionString)
CFlashVersionInfo::CFlashVersionInfo(const std::string & _versionString)
{
//SBBBYYYYMMTTHHMM -- formatsting
std::string versionString = _versionString;
/* just to make sure the string is long enough for the following code
* trailing chars don't matter -- will just be ignored */
if (versionString.size() < 16)
versionString.append(16, '0');
// recover type
snapshot = versionString[0];