prevent loading garbage

This commit is contained in:
conrad
2021-11-17 15:01:13 +10:00
parent 43dc821982
commit 3b9e384ecb
+10 -1
View File
@@ -469,7 +469,16 @@ diskio::convert_token(eT& val, const std::string& token)
{
// unsigned integer
if(str[0] == '-') { val = eT(0); return true; }
if((str[0] == '-') && (N >= 2))
{
const char* str_offset1 = &(str[1]);
std::strtoull(str_offset1, &endptr, 10);
if(str_offset1 == endptr) { return false; }
val = eT(0); return true;
}
val = eT( std::strtoull(str, &endptr, 10) );
}