diff options
author | Andy Wingo <wingo@pobox.com> | 2017-03-01 14:48:37 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2017-03-01 14:51:21 +0100 |
commit | ca739a29ce7bb754545f5b037014b579aec7be99 (patch) | |
tree | 545afd33911075f7338d5c7234f509fb649629eb | |
parent | 232e199734433246edce9d9a797fdc36c0f8b291 (diff) | |
download | guile-ca739a29ce7bb754545f5b037014b579aec7be99.tar.gz |
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.
-rw-r--r-- | libguile/filesys.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libguile/filesys.c b/libguile/filesys.c index e6e37b040..9bd746f30 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -1468,6 +1468,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); |