rusticl/disk_cache: fix stack corruption

The length passed to mesa_bytes_to_hex is the one of the input, not output
data.

Fixes: fbe9a7ca3e ("rusticl/mesa: create proper build-id hash for the disk cache")
Signed-off-by: Karol Herbst <git@karolherbst.de>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24967>
This commit is contained in:
Karol Herbst 2023-08-31 12:31:16 +02:00 committed by Marge Bot
parent bcc0ec8e6c
commit 1a20ac7891

View file

@ -89,11 +89,7 @@ impl DiskCache {
}
}
SHA1Final(&mut sha, &mut sha_ctx);
mesa_bytes_to_hex(
cache_id.as_mut_ptr(),
sha.as_ptr(),
(cache_id.len() - 1) as u32,
);
mesa_bytes_to_hex(cache_id.as_mut_ptr(), sha.as_ptr(), sha.len() as u32);
disk_cache_create(c_name.as_ptr(), cache_id.as_ptr(), flags)
};