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_6_13~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e3b044e44359ba34a31adead3dad0d69aa02ca8;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 a9e2e178b7..c0bcbd810c 100644 --- a/src/ip/QosConfig.cc +++ b/src/ip/QosConfig.cc @@ -390,12 +390,13 @@ 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())) { debugs(3, DBG_CRITICAL, "ERROR: Bad mark miss value " << &token[5]); self_destruct(); } + 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."); @@ -405,12 +406,14 @@ 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())) { debugs(3, DBG_CRITICAL, "ERROR: Bad TOS miss value " << &token[5]); self_destruct(); } 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.");