Skip to content

Commit 8ef2446

Browse files
Sashkoandrewrk
authored andcommitted
DynLib: fix a typo in DynLib.openZ
1 parent cb308ba commit 8ef2446

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/std/dynamic_library.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub const DynLib = struct {
3131

3232
/// Trusts the file. Malicious file will be able to execute arbitrary code.
3333
pub fn openZ(path_c: [*:0]const u8) Error!DynLib {
34-
return .{ .inner = try InnerType.open(path_c) };
34+
return .{ .inner = try InnerType.openZ(path_c) };
3535
}
3636

3737
/// Trusts the file.
@@ -376,7 +376,7 @@ pub const WindowsDynLib = struct {
376376
/// WindowsDynLib specific
377377
/// Opens dynamic library with specified library loading flags.
378378
pub fn openExZ(path_c: [*:0]const u8, flags: windows.LoadLibraryFlags) Error!WindowsDynLib {
379-
const path_w = try windows.cStrToPrefixedFileW(null, path_c);
379+
const path_w = windows.cStrToPrefixedFileW(null, path_c) catch return error.InvalidPath;
380380
return openExW(path_w.span().ptr, flags);
381381
}
382382

@@ -466,4 +466,5 @@ test "dynamic_library" {
466466
};
467467

468468
try testing.expectError(error.FileNotFound, DynLib.open(libname));
469+
try testing.expectError(error.FileNotFound, DynLib.openZ(libname.ptr));
469470
}

0 commit comments

Comments
 (0)