From 7020c9e4a9f340bb390f13b27aef32450d165310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Rosowski?= Date: Fri, 17 Apr 2026 16:55:26 +0200 Subject: [PATCH] std.os.uefi: pass null terminator in `(un)installMultipleProtocolInterfaces` --- lib/std/os/uefi/tables/boot_services.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/std/os/uefi/tables/boot_services.zig b/lib/std/os/uefi/tables/boot_services.zig index c864fec9bfd03cbfb321b05e4275e2969799d9f9..219c3704d1031d3440f3343a411dcea9ce6f3e5d 100644 --- a/lib/std/os/uefi/tables/boot_services.zig +++ b/lib/std/os/uefi/tables/boot_services.zig @@ -1236,6 +1236,7 @@ fn protocolInterfaces( @TypeOf(interfaces), ) = undefined; result[0] = handle_arg; + result[result.len - 1] = null; comptime var idx: usize = 1; inline for (interfaces) |interface| { @@ -1270,13 +1271,15 @@ fn ProtocolInterfaces(HandleType: type, Interfaces: type) type { @compileError("expected tuple of protocol interfaces, got " ++ @typeName(Interfaces)); const interfaces_info = interfaces_type_info.@"struct"; - var tuple_types: [interfaces_info.fields.len * 2 + 1]type = undefined; + var tuple_types: [interfaces_info.fields.len * 2 + 2]type = undefined; tuple_types[0] = HandleType; + tuple_types[tuple_types.len - 1] = ?*const Guid; + var idx = 1; - while (idx < tuple_types.len) : (idx += 2) { + while (idx < tuple_types.len - 1) : (idx += 2) { tuple_types[idx] = *const Guid; tuple_types[idx + 1] = *const anyopaque; } - return std.meta.Tuple(tuple_types[0..]); + return @Tuple(tuple_types[0..]); } -- 2.54.0