From 77c0913f7577d20fbb8a8ead522199cd079ea122 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 10 Nov 2024 10:36:46 +0100 Subject: check_swap: Use sscanf more precisely to avoid false matches --- plugins/check_swap.d/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/check_swap.d/swap.c b/plugins/check_swap.d/swap.c index 293fdd71..17c4f73b 100644 --- a/plugins/check_swap.d/swap.c +++ b/plugins/check_swap.d/swap.c @@ -99,7 +99,7 @@ swap_result getSwapFromProcMeminfo(char proc_meminfo[]) { } else if (sscanf(input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFreCchd]%*[:] %lu " "%*[k]%*[B]", - str, &tmp_KB)) { + str, &tmp_KB) == 2) { if (verbose >= 3) { printf("Got %s with %lu\n", str, tmp_KB); -- cgit v1.2.3-74-g34f1