]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Consistently check strcspn return value (#2166)
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Sat, 6 Sep 2025 07:04:21 +0000 (07:04 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 6 Sep 2025 07:04:24 +0000 (07:04 +0000)
src/format/Format.cc
src/format/Token.cc
src/http/Message.cc
src/tools.cc

index 3612590d8efc211946a36ea2e2004d39a0e13e9d..711082379c6c3653da8e1d612c833de97c8cdcfe 100644 (file)
@@ -294,7 +294,7 @@ log_quoted_string(const char *str, char *out)
     char *p = out;
 
     while (*str) {
-        int l = strcspn(str, "\"\\\r\n\t");
+        const auto l = strcspn(str, "\"\\\r\n\t");
         memcpy(p, str, l);
         str += l;
         p += l;
index 3b1da3e5bc4ba6ee3110a5e99e2f0f48620f894d..0b569c2430573755eb83a2b3fcfc0c198f450376 100644 (file)
@@ -354,9 +354,7 @@ Format::Token::parse(const char *def, Quoting *quoting)
 {
     const char *cur = def;
 
-    int l;
-
-    l = strcspn(cur, "%");
+    auto l = strcspn(cur, "%");
 
     if (l > 0) {
         char *cp;
index 7c575eb2496ba3a4f0bcba75bd94850c71ec714f..bd40c89497819ea930882a3e99c2de1c052af163 100644 (file)
@@ -41,7 +41,7 @@ Http::Message::putCc(const HttpHdrCc &otherCc)
 static int
 httpMsgIsolateStart(const char **parse_start, const char **blk_start, const char **blk_end)
 {
-    int slen = strcspn(*parse_start, "\r\n");
+    const auto slen = strcspn(*parse_start, "\r\n");
 
     if (!(*parse_start)[slen])  /* no CRLF found */
         return 0;
index 989f55636e6e42a7968296a10c797ae460d7c0eb..5361b759a9c02f0533dac8137c50b9cb4c4b1ff2 100644 (file)
@@ -1088,7 +1088,7 @@ strwordquote(MemBuf * mb, const char *str)
     }
 
     while (*str) {
-        int l = strcspn(str, "\"\\\n\r");
+        const auto l = strcspn(str, "\"\\\n\r");
         mb->append(str, l);
         str += l;