summaryrefslogtreecommitdiff
path: root/libguile/fports.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-03-01 17:34:41 +0100
committerAndy Wingo <wingo@pobox.com>2017-03-01 17:34:41 +0100
commit82ea7c763b5f6b030583ef354263b33855111160 (patch)
tree1aa7980be9b2a3ce62bd11cac9b046fe01214dc4 /libguile/fports.c
parent24eea1be08391475fe932f44df51ebe1aca75a2b (diff)
downloadguile-82ea7c763b5f6b030583ef354263b33855111160.tar.gz
Fix open-file mode misinterpretation
* libguile/fports.c (scm_i_mode_to_open_flags): Validate that argument is string. Fixes #25498.
Diffstat (limited to 'libguile/fports.c')
-rw-r--r--libguile/fports.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libguile/fports.c b/libguile/fports.c
index f79b4a3a8..94092b872 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -159,6 +159,9 @@ scm_i_mode_to_open_flags (SCM mode, int *is_binary, const char *FUNC_NAME)
int flags = 0;
const char *md, *ptr;
+ if (SCM_UNLIKELY (!scm_is_string (mode)))
+ scm_out_of_range (FUNC_NAME, mode);
+
if (SCM_UNLIKELY (!scm_i_try_narrow_string (mode)))
scm_out_of_range (FUNC_NAME, mode);