From 7a77884a66be59eca14dc468e115d008010a7129 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 1 Mar 2026 04:03:15 +0100 Subject: [PATCH] clang-tidy: enable `clang-analyzer-*` checks explicitly, fix fallout v22.1.0 disabled them by default. Fix fallout: - http: check NULL to silence false positives in `HD_VAL()`. Ref: https://releases.llvm.org/22.1.0/tools/clang/tools/extra/docs/ReleaseNotes.html#improvements-to-clang-tidy Follow-up to da6fbb12a6598a7c9e9e54d66e1454973ffc888e #20779 Follow-up to ce4db9c2efca0bd89e556e231d940c988d84a606 #20751 Closes #20778 --- .clang-tidy.yml | 1 + lib/http.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.clang-tidy.yml b/.clang-tidy.yml index c82a8f29ba..83052420de 100644 --- a/.clang-tidy.yml +++ b/.clang-tidy.yml @@ -6,6 +6,7 @@ # https://clang.llvm.org/extra/clang-tidy/checks/list.html Checks: + - clang-analyzer-* - -clang-analyzer-optin.performance.Padding - -clang-analyzer-security.ArrayBound # due to false positives with clang-tidy v21.1.0 - -clang-analyzer-security.insecureAPI.bzero # for FD_ZERO() (seen on macOS) diff --git a/lib/http.c b/lib/http.c index 61d426d9f5..e9ef131f8e 100644 --- a/lib/http.c +++ b/lib/http.c @@ -3185,7 +3185,7 @@ static statusline checkprotoprefix(struct Curl_easy *data, (((hdlen) >= (sizeof(n) - 1)) && curl_strnequal(n, hd, sizeof(n) - 1)) #define HD_VAL(hd, hdlen, n) \ - ((((hdlen) >= (sizeof(n) - 1)) && \ + ((((hdlen) >= (sizeof(n) - 1)) && (hd) && \ curl_strnequal(n, hd, sizeof(n) - 1)) ? ((hd) + (sizeof(n) - 1)) : NULL) /* HTTP header has field name `n` (a string constant) and contains `v`