[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/01: Fix open-file mode misinterpretation
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/01: Fix open-file mode misinterpretation |
Date: |
Wed, 1 Mar 2017 11:37:20 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 82ea7c763b5f6b030583ef354263b33855111160
Author: Andy Wingo <address@hidden>
Date: Wed Mar 1 17:34:41 2017 +0100
Fix open-file mode misinterpretation
* libguile/fports.c (scm_i_mode_to_open_flags): Validate that argument
is string. Fixes #25498.
---
libguile/fports.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libguile/fports.c b/libguile/fports.c
index f79b4a3..94092b8 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);