fix: resolve use-afer-free in backup.zig

This worked fine on stage1, and works fine in debug in stage3.
However, stage3 ReleaseSafe would panic due to what I assume must
have been an undefined behaviour optimization.

While I'm happy that I was quickly made aware of the issue thanks to
the safety checks in ReleaseSafe I do wish that this issue showed itself
in Debug, since I *am* using the GPA
This commit is contained in:
2022-08-26 13:04:09 -05:00
parent 2ab8769b7a
commit e5b7441740
3 changed files with 12 additions and 13 deletions

View File

@@ -69,7 +69,7 @@ pub fn intToBytes(comptime T: type, value: anytype) [@sizeOf(T)]u8 {
///
/// This function returns a slice of everything just before the first
/// `\0`
pub fn asString(title: [12]u8) []const u8 {
pub fn asStringSlice(title: *const [12]u8) []const u8 {
var len = title.len;
for (title) |char, i| {
if (char == 0) {