fix: prevent division by zero in intHandler when no events received
@MarioHewardt y travaille déjà.
Depuis le 4/4/2026.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
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)
- Langage dominant
- C
- Étoiles
- 2.2k
- Forks
- 220
- Merge moyen
- 11 j 22 h
- PR mergées (30 j)
- 2
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/SysmonForLinux
-
microsoft/SysmonForLinux#238 · 1 personne assignée ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
microsoft/SysmonForLinux#233 ·
-
microsoft/SysmonForLinux#226 · 1 personne assignée ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
microsoft/SysmonForLinux#220 · 2 réactions ·
-
microsoft/SysmonForLinux#219 · 1 commentaire · 1 personne assignée ·
Toutes les issues de microsoft/SysmonForLinux
Issues similaires
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
HarbourMasters/Shipwright#7229 ·
-
Error while building from source Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 commentaire ·
-
bug Self Built Image SNAPSHOT Supported Device target/ramips
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100