From ba75167d1e7c609b829978b3f4a748ce3cf69ad9 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 25 Sep 2021 13:09:01 -0700 Subject: New function: replace-env. Using this new function together with env, it's now possible to save the set of environment variables, clobber it to a specified set (possibly empty) and then restore it. Useful for improved security in running child processes. * lib.[ch] (chk_substrdup_utf8): New function. * sysif.c (replace_env): New function. (sysif_init): Register replace-env intrinsic. * sysif.h (replace_env): Declared. * txr.1: Documented. * stdlib/doc-syms.tl: Updated. --- lib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib.h') diff --git a/lib.h b/lib.h index f5b5ed42..25cfc6d1 100644 --- a/lib.h +++ b/lib.h @@ -735,6 +735,7 @@ wchar_t *chk_wrealloc(wchar_t *, size_t nwchar); wchar_t *chk_strdup(const wchar_t *str); wchar_t *chk_substrdup(const wchar_t *str, size_t off, size_t len); char *chk_strdup_utf8(const char *str); +char *chk_substrdup_utf8(const char *str, size_t off, size_t len); unsigned char *chk_strdup_8bit(const wchar_t *str); mem_t *chk_copy_obj(mem_t *orig, size_t size); mem_t *chk_xalloc(ucnum m, ucnum n, val self); -- cgit v1.2.3