guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/01: Fix (mkstemp! "XX" 0) errors


From: Andy Wingo
Subject: [Guile-commits] 01/01: Fix (mkstemp! "XX" 0) errors
Date: Wed, 1 Mar 2017 08:51:08 -0500 (EST)

wingo pushed a commit to branch master
in repository guile.

commit a86bb2e613f050e63275c357d7df41f019d5efc8
Author: Andy Wingo <address@hidden>
Date:   Wed Mar 1 14:48:37 2017 +0100

    Fix (mkstemp! "XX" 0) errors
    
    * libguile/filesys.c (scm_i_mkstemp): Validate "mode" argument as a
      string, and validate writability of template string early too.  Thanks
      to Jean Louis for the bug report.
---
 libguile/filesys.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libguile/filesys.c b/libguile/filesys.c
index 40d5a41..b5b7e72 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -1475,6 +1475,14 @@ SCM_DEFINE (scm_i_mkstemp, "mkstemp!", 1, 1, 0,
   int open_flags, is_binary;
   SCM port;
 
+  SCM_VALIDATE_STRING (SCM_ARG1, tmpl);
+  if (!SCM_UNBNDP (mode))
+    SCM_VALIDATE_STRING (SCM_ARG2, mode);
+
+  /* Ensure tmpl is mutable.  */
+  scm_i_string_start_writing (tmpl);
+  scm_i_string_stop_writing ();
+
   scm_dynwind_begin (0);
 
   c_tmpl = scm_to_locale_string (tmpl);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]