summaryrefslogtreecommitdiffstats
path: root/Settings.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2024-01-20 11:51:20 +0100
committerBenBE <BenBE@geshi.org>2024-01-25 10:03:26 +0100
commit94c78224015bfb461a124b994a78c37f8c2a3e34 (patch)
tree56bec236e69248302b79a9548cf1aa4aaf323775 /Settings.c
parent207db2e8f8874de7b8cfe43fa5ce7cb7c06b5097 (diff)
Explicitly check sscanf(3) and fscanf(3) return values
Compare the return value of sscanf(3) and fscanf(3) explicitly against the expected number of parsed items and avoid implicit boolean conversion. Such an implicit conversion would treat EOF (-1) the same as at least one item parsed successfully. Reported by CodeQL.
Diffstat (limited to 'Settings.c')
-rw-r--r--Settings.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Settings.c b/Settings.c
index a01e2494..815224be 100644
--- a/Settings.c
+++ b/Settings.c
@@ -240,7 +240,7 @@ static int toFieldIndex(Hashtable* columns, const char* str) {
} else {
// Dynamically-defined columns are always stored by-name.
char dynamic[32] = {0};
- if (sscanf(str, "Dynamic(%30s)", dynamic)) {
+ if (sscanf(str, "Dynamic(%30s)", dynamic) == 1) {
char* end;
if ((end = strrchr(dynamic, ')')) != NULL) {
bool success;

© 2014-2024 Faster IT GmbH | imprint | privacy policy