cargo: add patches for CVE-2026-5222 and CVE-2026-5223

Upstream pull request: https://github.com/rust-lang/cargo/pull/17031

Fixes: CVE-2026-5222, https://blog.rust-lang.org/2026/05/25/cve-2026-5222/
Fixes: CVE-2026-5223, https://blog.rust-lang.org/2026/05/25/cve-2026-5223/
Not-cherry-picked-because: master will get these fixes via the rust 1.96 upgrade on 2026-05-28
(cherry picked from commit 5f1133b2f1e36b654119f042b8eaf9f16aff706c)
This commit is contained in:
whispers
2026-06-22 08:16:16 +02:00
committed by Vladimír Čunát
parent d0551bc010
commit a7e09a45bb
+18
View File
@@ -3,6 +3,7 @@
stdenv,
pkgsHostHost,
pkgsBuildBuild,
fetchpatch,
file,
curl,
pkg-config,
@@ -26,6 +27,23 @@ rustPlatform.buildRustPackage.override
pname = "cargo";
inherit (rustc.unwrapped) version src;
patches = [
(fetchpatch {
name = "CVE-2026-5222.patch";
url = "https://github.com/rust-lang/cargo/commit/c4d63a44234de22dc745231c416b80ed848d997f.patch";
stripLen = 1;
extraPrefix = "src/tools/cargo/";
hash = "sha256-YG7xtC308z+o1xVzrV81qqWov1121GVouyAXKflyBF8=";
})
(fetchpatch {
name = "CVE-2026-5223.patch";
url = "https://github.com/rust-lang/cargo/commit/285cebf58911eca5b7f177f5d0b1c53e1f646577.patch";
stripLen = 1;
extraPrefix = "src/tools/cargo/";
hash = "sha256-DbmPQ31N4AIYZEBiwwGAn59hgPsFEVTzA6PrI071LXE=";
})
];
# the rust source tarball already has all the dependencies vendored, no need to fetch them again
cargoVendorDir = "vendor";
buildAndTestSubdir = "src/tools/cargo";