From 3db0c23a9254f87ac1f3ee61ec3325391f4a0e9f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 30 Jun 2005 19:09:24 +0000 Subject: [PATCH] call security guard for truncate-file svn: r281 original commit: c3147b6468115034db4d771164e2eee9fc420c28 --- collects/mzlib/os.ss | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/collects/mzlib/os.ss b/collects/mzlib/os.ss index 960aff2..9580d7d 100644 --- a/collects/mzlib/os.ss +++ b/collects/mzlib/os.ss @@ -115,6 +115,11 @@ val (fail-k))) + (define scheme_security_check_file + (delay-ffi-obj "scheme_security_check_file" #f + (_fun _string _string _int -> _void))) + (define SCHEME_GUARD_FILE_WRITE #x2) + ;; truncate-file : path int -> void (define truncate-file (opt-lambda (file [size 0]) @@ -122,6 +127,10 @@ (error 'truncate-file "expects argument of type or ; given ~s" file)) (when (not (integer? size)) (error 'truncate-file "expects argument of type ; given ~s" size)) + ((force scheme_security_check_file) + "truncate-file" + (if (path? file) (path->string file) file) + SCHEME_GUARD_FILE_WRITE) (let ([fd (on-c-fail ((force open) file O_WRONLY) (lambda ()