mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-22 19:23:31 +00:00
Fixed edge case that could cause an infinite loop
This commit is contained in:
@@ -77,7 +77,8 @@ function SMBiosTables()
|
|||||||
var SMData;
|
var SMData;
|
||||||
var structcount = 0;
|
var structcount = 0;
|
||||||
|
|
||||||
while (SMData && i < SMData.length) {
|
while (SMData && i < SMData.length)
|
||||||
|
{
|
||||||
var SMtype = SMData[i];
|
var SMtype = SMData[i];
|
||||||
var SMlength = SMData[i + 1];
|
var SMlength = SMData[i + 1];
|
||||||
|
|
||||||
@@ -88,12 +89,20 @@ function SMBiosTables()
|
|||||||
|
|
||||||
ret[SMtype].peek()._strings = [];
|
ret[SMtype].peek()._strings = [];
|
||||||
|
|
||||||
while (SMData[i] != 0) {
|
while (SMData[i] != 0 && i <= SMData.length)
|
||||||
|
{
|
||||||
var strstart = i;
|
var strstart = i;
|
||||||
|
|
||||||
// Start of String, find end of string
|
// Start of String, find end of string
|
||||||
while (SMData[i++] != 0);
|
while (SMData[i++] != 0 && i <= SMData.length);
|
||||||
ret[SMtype].peek()._strings.push(SMData.slice(strstart, i).toString().trim());
|
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;
|
i += (ret[SMtype].peek()._strings.length == 0) ? 2 : 1;
|
||||||
++structcount;
|
++structcount;
|
||||||
|
|||||||
Reference in New Issue
Block a user