From: Alex Rousskov Date: Tue, 14 Jan 2025 19:22:36 +0000 (+0000) Subject: Bug 5481: Fix GCC v14 build [-Wmaybe-uninitialized] (#1982) X-Git-Tag: SQUID_7_0_1~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c77c4b24bea35013ec3818a1260f94133d39e94;p=thirdparty%2Fsquid.git Bug 5481: Fix GCC v14 build [-Wmaybe-uninitialized] (#1982) Successful xstrtoui(start,end) calls do initialize `end`, but we can polish this code and avoid triggering that GCC warning at the same time. --- diff --git a/src/ip/QosConfig.cc b/src/ip/QosConfig.cc index aede0c613b..bc26401a2f 100644 --- a/src/ip/QosConfig.cc +++ b/src/ip/QosConfig.cc @@ -383,11 +383,12 @@ Ip::Qos::Config::parseConfigLine() } else if (strncmp(token, "miss=",5) == 0) { - char *end; if (mark) { + char *end = nullptr; if (!xstrtoui(&token[5], &end, &markMiss, 0, std::numeric_limits::max())) { throw TextException(ToSBuf("Bad mark miss value ", &token[5]), Here()); } + Assure(end); if (*end == '/') { if (!xstrtoui(end + 1, nullptr, &markMissMask, 0, std::numeric_limits::max())) { debugs(3, DBG_CRITICAL, "ERROR: Bad mark miss mask value " << (end + 1) << ". Using 0xFFFFFFFF instead."); @@ -397,11 +398,13 @@ Ip::Qos::Config::parseConfigLine() markMissMask = 0xFFFFFFFF; } } else { + char *end = nullptr; unsigned int v = 0; if (!xstrtoui(&token[5], &end, &v, 0, std::numeric_limits::max())) { throw TextException(ToSBuf("Bad TOS miss value ", &token[5]), Here()); } tosMiss = (tos_t)v; + Assure(end); if (*end == '/') { if (!xstrtoui(end + 1, nullptr, &v, 0, std::numeric_limits::max())) { debugs(3, DBG_CRITICAL, "ERROR: Bad TOS miss mask value " << (end + 1) << ". Using 0xFF instead.");