1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Fix open-file mode misinterpretation

* libguile/fports.c (scm_i_mode_to_open_flags): Validate that argument
  is string.  Fixes #25498.
This commit is contained in:
Andy Wingo 2017-03-01 17:34:41 +01:00
parent 24eea1be08
commit 82ea7c763b

View file

@ -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);