monitoring-plugins/plugins-root
Holger Weiss a675995b19 check_icmp: Fix parsing of single-char threshold
The threshold parser starts a pointer at the last character of the
string and walks it backwards until it reaches the second character.
This assumes the string is at least two characters long.  For a
single-character threshold such as "-w 1" or "-c 1", the pointer
underflows past the start of the string and keeps dereferencing memory
out of bounds.

Beyond the out-of-bounds reads, an out-of-bounds write can occur if a
stray '%' or ',' byte happens to turn up while scanning backwards.  In
that case, the parser writes a NUL byte at that out-of-bounds address
(the ',' case additionally re-reads forward from there via strtoul(3)).

Only run the descending scan when the string has at least two
characters, leaving the behaviour for all valid thresholds unchanged.

Reported-by: Christopher Kreft <Email@ChristopherKreft.de>
2026-06-30 15:58:09 +02:00
..
check_dhcp.d Refactor check_dhcp 2025-06-23 12:09:58 +02:00
check_icmp.d More refactoring 2025-09-15 15:49:26 +02:00
t Reapply "check_dhcp: reduce number of tests for weird reasons" 2025-06-23 13:21:25 +02:00
check_dhcp.c Run clang-format again 2025-09-15 12:59:37 +02:00
check_icmp.c check_icmp: Fix parsing of single-char threshold 2026-06-30 15:58:09 +02:00
Makefile.am Add check_dhcp related files to Makefile 2025-06-23 13:02:41 +02:00
pst3.c Run clang-format again 2025-09-15 12:59:37 +02:00