diff options
| author | Cody Tapscott <topolarity@tapscott.me> | 2022-07-19 23:31:38 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-20 03:45:29 -0400 |
| commit | de62bd06472e5603fd2afb6f50d688d54f4098b4 (patch) | |
| tree | 3943dc865e71007aa56d2bc6615af3f711dbd1e0 /lib/std/macho.zig | |
| parent | 0efc6a35bead74b5faffbc87b446b5087f1bb99b (diff) | |
| download | zig-de62bd06472e5603fd2afb6f50d688d54f4098b4.tar.gz zig-de62bd06472e5603fd2afb6f50d688d54f4098b4.zip | |
macho: Pass sections by pointer when slicing names
We were accidentally returning a pointer to stack memory, because these
arguments were passed by value. It's just an accident that stage 1 was
passing these by reference, so things were alright until stage 3.
Diffstat (limited to 'lib/std/macho.zig')
| -rw-r--r-- | lib/std/macho.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/macho.zig b/lib/std/macho.zig index 67b0be9fda..cd4bfa37fb 100644 --- a/lib/std/macho.zig +++ b/lib/std/macho.zig @@ -653,7 +653,7 @@ pub const segment_command_64 = extern struct { nsects: u32 = 0, flags: u32 = 0, - pub fn segName(seg: segment_command_64) []const u8 { + pub fn segName(seg: *const segment_command_64) []const u8 { return parseName(&seg.segname); } }; @@ -772,11 +772,11 @@ pub const section_64 = extern struct { /// reserved reserved3: u32 = 0, - pub fn sectName(sect: section_64) []const u8 { + pub fn sectName(sect: *const section_64) []const u8 { return parseName(§.sectname); } - pub fn segName(sect: section_64) []const u8 { + pub fn segName(sect: *const section_64) []const u8 { return parseName(§.segname); } |
