aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-08-14 06:53:21 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-08-14 06:53:21 +0000
commiteb185bfa47bad124149d8f921825231141d10b20 (patch)
tree097b9c90c4958a0ae90dd8fa9bb53dd139128853
parentmain: spell out the most common reason for setlocale() to fail (diff)
utils/xtgettcap: fix possible NULL deref, found by -fanalyzer
-rw-r--r--utils/xtgettcap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils/xtgettcap.c b/utils/xtgettcap.c
index 069a9ecb..82ee0085 100644
--- a/utils/xtgettcap.c
+++ b/utils/xtgettcap.c
@@ -141,6 +141,9 @@ main(int argc, const char *const *argv)
const char *key = strtok(key_value, "=");
const char *value = strtok(NULL, "=");
+ if (key == NULL)
+ continue;
+
#if 0
assert((success && value != NULL) ||
(!success && value == NULL));