mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 15:40:19 +02:00
Ensure that shared substrings are handled properly when passed to
a system call or other foreign function. Many thanks to Tim Pierce! * symbols.h (SCM_COERCE_SUBSTR): new macro. * filesys.c (scm_chmod, scm_rename, scm_delete_file, scm_mkdir, scm_rmdir, scm_opendir, scm_chdir, scm_symlink, scm_readlink, scm_lstat), ports.c (scm_sys_make_void_port), posix.c (scm_utime, scm_putenv, scm_setlocale, scm_mknod), stime.c (setzone, scm_strftime), vports.c (scm_make_soft_port), backtrace.c (scm_display_error_message): use RO macros when strings may be RO. * error.c (scm_error_scm), filesys.c (scm_chown, scm_chmod, scm_rename, scm_delete_file, scm_mkdir, scm_rmdir, scm_opendir, scm_chdir, scm_symlink, scm_readlink, scm_lstat), ioext.c (scm_freopen, scm_duplicate_port, scm_fdopen), net_db.c (scm_gethost, scm_getnet, scm_getproto, scm_getserv), ports.c (scm_sys_make_void_port), posix.c (scm_getgrgid, scm_utime, scm_setlocale, scm_mknod), stime.c (setzone, scm_strptime, scm_strftime), vports.c (scm_make_soft_port): use SCM_COERCE_SUBSTR to make sure shared substrings are null-terminated.
This commit is contained in:
parent
dec4cca94f
commit
89958ad0ef
10 changed files with 95 additions and 43 deletions
|
@ -84,7 +84,8 @@ scm_error (key, subr, message, args, rest)
|
|||
|
||||
/* No return, but just in case: */
|
||||
|
||||
write (2, "unhandled system error", sizeof ("unhandled system error") - 1);
|
||||
write (2, "unhandled system error\n",
|
||||
sizeof ("unhandled system error\n") - 1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -105,6 +106,8 @@ scm_error_scm (key, subr, message, args, rest)
|
|||
|| (SCM_NIMP (message) && SCM_ROSTRINGP (message)),
|
||||
message, SCM_ARG3, s_error_scm);
|
||||
|
||||
SCM_COERCE_SUBSTR (message);
|
||||
|
||||
scm_error (key,
|
||||
(SCM_FALSEP (subr)) ? NULL : SCM_ROCHARS (subr),
|
||||
(SCM_FALSEP (message)) ? NULL : SCM_ROCHARS (message),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue