1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

Fixed edge case that could cause an infinite loop

This commit is contained in:
Bryan Roe
2019-01-31 22:38:56 -08:00
parent 5995742cef
commit da44eddf29

View File

@@ -77,7 +77,8 @@ function SMBiosTables()
var SMData;
var structcount = 0;
while (SMData && i < SMData.length) {
while (SMData && i < SMData.length)
{
var SMtype = SMData[i];
var SMlength = SMData[i + 1];
@@ -88,12 +89,20 @@ function SMBiosTables()
ret[SMtype].peek()._strings = [];
while (SMData[i] != 0) {
while (SMData[i] != 0 && i <= SMData.length)
{
var strstart = i;
// Start of String, find end of string
while (SMData[i++] != 0);
ret[SMtype].peek()._strings.push(SMData.slice(strstart, i).toString().trim());
while (SMData[i++] != 0 && i <= SMData.length);
try
{
ret[SMtype].peek()._strings.push(SMData.slice(strstart, i).toString().trim());
}
catch (ee)
{
console.log('oops');
}
}
i += (ret[SMtype].peek()._strings.length == 0) ? 2 : 1;
++structcount;