File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments