~ chicken-core (master) 5981b6516ab3229c8b20b7e0ffa8bf60446a3646


commit 5981b6516ab3229c8b20b7e0ffa8bf60446a3646
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Mon Oct 19 14:52:14 2026 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Oct 19 22:20:20 2026 +0200

    Update manual information about the c-string foreign type
    
    The string contents are no longer copied (for efficiency reasons),
    which means the data could be corrupted by the called function.
    This warrants a warning.
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/manual/Foreign type specifiers b/manual/Foreign type specifiers
index 55d3f815..aac67faa 100644
--- a/manual/Foreign type specifiers	
+++ b/manual/Foreign type specifiers	
@@ -147,10 +147,13 @@ converts to inexact.
 
 A zero-terminated C string. The argument value {{#f}} is allowed and
 is passed as a {{NULL}} pointer; similarly, a NULL pointer is returned
-as {{#f}}.  Note that the string contents are copied into (automatically
-managed) temporary storage with a zero byte appended when passed as an
-argument. Also, a return value of this type is copied into garbage
-collected memory using {{strcpy(3)}}.
+as {{#f}}.  Note that the C function should not write into the string,
+as this may invalidate guarantees made by the runtime about the string
+containing valid UTF-8 encoded data and cause silent corruption of
+internal string position bookkeeping.
+
+A return value of this type is copied into garbage collected memory
+using {{strcpy(3)}}.
 
 For the {{nonnull-}} variant, passing {{#f}} will raise an exception, and returning
 a NULL pointer will result in undefined behavior (e.g. a segfault).
Trap