-
Notifications
You must be signed in to change notification settings - Fork 0
fix(MESHCENT-004-2): 3 review findings in amt_heci.js #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -262,32 +262,32 @@ function amt_heci() { | |
| fn.apply(this, opt); | ||
| }, callback, optional); | ||
| } | ||
| this.startConfiguration = function () { | ||
| this.startConfiguration = function (callback) { | ||
| var optional = []; | ||
| for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x29, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); | ||
| for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x29, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); | ||
| } | ||
| this.stopConfiguration = function () { | ||
| this.stopConfiguration = function (callback) { | ||
| var optional = []; | ||
| for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x5E, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); | ||
| for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x5E, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); | ||
| } | ||
| this.openUserInitiatedConnection = function () { | ||
| this.openUserInitiatedConnection = function (callback) { | ||
| var optional = []; | ||
| for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x44, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); | ||
| for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x44, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); | ||
| } | ||
| this.closeUserInitiatedConnection = function () { | ||
| this.closeUserInitiatedConnection = function (callback) { | ||
| var optional = []; | ||
| for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x45, data, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); | ||
| for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x45, null, function (header, fn, opt) { opt.unshift(header.Status); fn.apply(this, opt); }, callback, optional); | ||
| } | ||
| this.getRemoteAccessConnectionStatus = function () { | ||
| this.getRemoteAccessConnectionStatus = function (callback) { | ||
| var optional = []; | ||
| for (var i = 2; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x46, data, function (header, fn, opt) { | ||
| for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
| this.sendCommand(0x46, null, function (header, fn, opt) { | ||
| if (header.Status == 0) { | ||
| var hostname = v.slice(14, header.Data.readUInt16LE(12) + 14).toString() | ||
| var hostname = header.Data.slice(14, header.Data.readUInt16LE(12) + 14).toString() | ||
| opt.unshift({ status: header.Status, networkStatus: header.Data.readUInt32LE(0), remoteAccessStatus: header.Data.readUInt32LE(4), remoteAccessTrigger: header.Data.readUInt32LE(8), mpsHostname: hostname, raw: header.Data }); | ||
| } else { | ||
| opt.unshift({ status: header.Status }); | ||
|
Comment on lines
262
to
293
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ amt_heci.js sendCommand references undefined 'callback' variable via unshifted arguments, and multiple call sites reference undefined 'data' Fixed startConfiguration, stopConfiguration, openUserInitiatedConnection, closeUserInitiatedConnection, and getRemoteAccessConnectionStatus: each now declares (Automatically downgraded: no change in this fix lands near this finding's line β verify whether it was actually addressed.) π€ Prompt for AI agentsfix confidence: π΄ 40 low β review closely β react π/π to teach the reviewer
Comment on lines
262
to
293
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ getRemoteAccessConnectionStatus references undefined variable 'v' when parsing hostname In getRemoteAccessConnectionStatus's sendCommand callback, replaced the undefined π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
@@ -297,7 +297,7 @@ function amt_heci() { | |
| } | ||
| this.getProtocolVersion = function (callback) { | ||
| var optional = []; | ||
| for (var i = 1; i < arguments.length; ++i) { opt.push(arguments[i]); } | ||
| for (var i = 1; i < arguments.length; ++i) { optional.push(arguments[i]); } | ||
|
|
||
| heci.doIoctl(heci.IOCTL.HECI_VERSION, Buffer.alloc(5), Buffer.alloc(5), function (status, buffer, self, fn, opt) { | ||
| if (status == 0) { | ||
|
|
@@ -313,4 +313,4 @@ function amt_heci() { | |
| } | ||
| } | ||
|
|
||
| module.exports = amt_heci; | ||
| module.exports = amt_heci; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π΄ getProtocolVersion uses undefined 'opt' instead of 'optional' when building the optional args array
In getProtocolVersion, changed
opt.push(arguments[i])tooptional.push(arguments[i])in the argument-collection loop, matching the declaredvar optional = []and mirroring the pattern used by every other method in the file.π€ Prompt for AI agents
fix confidence: π’ 95 high β react π/π to teach the reviewer