fix: 修复 Web Stop 信号等待阻塞和 SMB 响应解析越界 panic

- scanner.go: 长驻插件等待信号时同时监听 ctx.Done(),Web Stop 可正常返回
- smb_protocol.go: 响应长度检查修正为 47,远端偏移量全部做边界校验
This commit is contained in:
ZacharyZcR
2026-04-27 19:19:53 +08:00
parent d7749c4766
commit 3bf1cb0376
2 changed files with 19 additions and 11 deletions
+6 -3
View File
@@ -109,11 +109,14 @@ func RunScan(ctx context.Context, info common.HostInfo, config *common.Config, s
}
common.LogInfo(i18n.GetText("press_ctrl_c_exit"))
// 优雅等待信号
// 优雅等待信号或 context 取消(Web Stop
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
<-sigChan
common.LogInfo(i18n.GetText("received_exit_signal"))
select {
case <-sigChan:
common.LogInfo(i18n.GetText("received_exit_signal"))
case <-ctx.Done():
}
cancel()
time.Sleep(500 * time.Millisecond)
}