fix: prevent division by zero in intHandler when no events received
@MarioHewardt 已經在處理了。
開始於 2026年4月4日。
評估
這個 Issue 還沒有評估資料。
描述
Summary
Fix a potential division by zero crash in the intHandler signal
handler when Sysmon is stopped before processing any events
(totalEvents == 0).
Problem
In intHandler(), the following line:
printf("Total events: %ld, bad events: %ld, ratio = %f\n",
totalEvents, badEvents, (double)badEvents / totalEvents);
...will produce a division by zero (resulting in NaN or crash) if
Sysmon is interrupted immediately after startup before any eBPF
events are received.
Fix
Guard the division with a ternary check:
(double)badEvents / totalEvents
→
totalEvents > 0 ? (double)badEvents / totalEvents : 0.0
Testing
- Start Sysmon and immediately send SIGINT (Ctrl+C)
- Confirm clean output showing ratio = 0.000000 instead of crash/NaN
Notes
- No functional change to normal operation
- Zero risk of regression
- Fixes undefined behavior per C standard (integer division by zero)
- 主要語言
- C
- 星號
- 2.2k
- 分支
- 224
- 平均合併
- 4 小時 50 分鐘
- 30 天內合併 PR
- 3
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/Sysmon-Linux 的其他 Issue
-
難度 3/5 1-2 天 新手友好度 68/100
microsoft/Sysmon-Linux#253 ·
-
難度 3/5 1-2 天 新手友好度 72/100
microsoft/Sysmon-Linux#252 ·
-
難度 3/5 1-2 天 新手友好度 55/100
microsoft/Sysmon-Linux#247 ·
-
難度 1/5 1 小時以內 新手友好度 12/100
microsoft/Sysmon-Linux#246 · 3 則留言 ·
-
Sysmon service executable remains `(deleted)` after restart, causing repeated needrestart restarts and systemd start-limit-hit可能重新可做 @MarioHewardt 於 32 天前認領,目前沒有進行中的 PR。 未關閉
microsoft/Sysmon-Linux#244 · 已指派 1 人 ·
查看 microsoft/Sysmon-Linux 的全部 Issue
相似的 Issue
-
bug game: 01008BA02525A000 ios
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
area/ysql kind/bug priority/medium status/awaiting-triage
難度 2/5 1-3 小時 新手友好度 78/100
yugabyte/yugabyte-db#37523 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 65/100
ly05010419/MacNativeGames#2079 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 73/100
ChupathingyCE/chupathingyce#1020 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100