From 7b1cdecc49bc77bde220fc575c8a00386c3f3bcf Mon Sep 17 00:00:00 2001 From: ChenYanpan Date: Wed, 8 Jul 2026 12:09:55 +0800 Subject: [PATCH] * src/metalink.c (clean_metalink_string): Fix inverted trailing-space check 37a40fcb added an `end > beg' bound guard to prevent a buffer underflow, but accidentally flipped the condition from `isspace' to `!isspace'. The loop therefore walked back over non-space characters instead of trailing whitespace, collapsing any string without a trailing newline to "". Every Metalink/HTTP resource URL was wiped, so wget could not follow any mirror and testenv/Test-metalink-http.py failed ("Expected file test.meta not found"). Restore the `isspace' condition. Copyright-paperwork-exempt: Yes Upstream commit (GitLab mirror): https://gitlab.com/gnuwget/wget/-/commit/7b1cdecc49bc77bde220fc575c8a00386c3f3bcf --- wget-1.25.0/src/metalink.c +++ wget-1.25.0/src/metalink.c @@ -1061,7 +1061,7 @@ end++; /* If we are at the end of the string, search the first legit character going backward. */ if (*end == '\0') - while (end > beg && !isspace(*(end - 1))) + while (end > beg && isspace(*(end - 1))) end--; new = xmemdup0 (beg, end - beg);