From 2463ef970d865cdbc1569293b4b31d67f9693927 Mon Sep 17 00:00:00 2001 From: Alfred Morgan Date: Tue, 14 Jul 2026 21:50:32 -0700 Subject: [PATCH] fixes #26007; apply #24703 self-append fix to the refc string runtime (#26009) Fix appendString to avoid writing extra null terminator. --- lib/system/sysstr.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim index c879558dd0..77e468b8c9 100644 --- a/lib/system/sysstr.nim +++ b/lib/system/sysstr.nim @@ -223,8 +223,9 @@ proc addChar(s: NimString, c: char): NimString = proc appendString(dest, src: NimString) {.compilerproc, inline.} = ## Raw, does not prepare `dest` space for copying if src != nil: - copyMem(addr(dest.data[dest.len]), addr(src.data), src.len + 1) + copyMem(addr(dest.data[dest.len]), addr(src.data), src.len) inc(dest.len, src.len) + dest.data[dest.len] = '\0' proc setLengthStr(s: NimString, newLen: int): NimString {.compilerRtl.} = ## Sets the `s` length to `newLen` zeroing memory on growth.