]> git.lizzy.rs Git - rust.git/blobdiff - src/shims/foreign_items/posix/macos.rs
avoid using unchecked casts or arithmetic
[rust.git] / src / shims / foreign_items / posix / macos.rs
index cb6cd9ba44b40a8f89c90ec97e4b8163c683a901..34661fb2383c308ca29fa270338efcb290619904 100644 (file)
@@ -56,6 +56,11 @@ fn emulate_foreign_item_by_name(
                 this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?;
             }
 
+            // Environment related shims
+            "_NSGetEnviron" => {
+                this.write_scalar(this.machine.env_vars.environ.unwrap().ptr, dest)?;
+            }
+
             // Time related shims
             "gettimeofday" => {
                 let result = this.gettimeofday(args[0], args[1])?;
@@ -92,7 +97,7 @@ fn emulate_foreign_item_by_name(
             "SecRandomCopyBytes" => {
                 let len = this.read_scalar(args[1])?.to_machine_usize(this)?;
                 let ptr = this.read_scalar(args[2])?.not_undef()?;
-                this.gen_random(ptr, len as usize)?;
+                this.gen_random(ptr, len)?;
                 this.write_null(dest)?;
             }