From 0c1462898b68d97a4ef76ecdfa8d7c04f71cac52 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Fri, 28 Jun 2024 10:50:37 +0800 Subject: [PATCH] TerminalShell / TerminalFont: fix CodeQL warnings --- src/detection/terminalfont/terminalfont.c | 2 +- src/detection/terminalshell/terminalshell.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detection/terminalfont/terminalfont.c b/src/detection/terminalfont/terminalfont.c index 18fc8eec7..63e0a6fc0 100644 --- a/src/detection/terminalfont/terminalfont.c +++ b/src/detection/terminalfont/terminalfont.c @@ -271,7 +271,7 @@ static bool queryKittyTerm(const char* query, FFstrbuf* res) for (const char* p = buffer; p[0] && p[1]; p += 2) { unsigned value; - if (sscanf(p, "%2x", &value)) + if (sscanf(p, "%2x", &value) == 1) ffStrbufAppendC(res, (char) value); } return true; diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index e0246ea37..28bd7c591 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -490,7 +490,7 @@ static bool getTerminalVersionKitty(FFstrbuf* exe, FFstrbuf* version) for (const char* p = versionHex; p[0] && p[1]; p += 2) { unsigned value; - if (sscanf(p, "%2x", &value)) + if (sscanf(p, "%2x", &value) == 1) ffStrbufAppendC(version, (char) value); } return true;