Files
Nim/lib/system
ringabout 1f07fdd2dc fixes #24664; always sets the \0 terminator in appendString (#24703)
fixes #24664

```nim
proc main() = 
    for i in 0..1:
        var s = "12345"
        s.add s
        echo s

main()
```
In the given example, `add` contains two steps: `prepareAdd` and
`appendString`. In the first step, a new buffer is created in order to
store the final doubled string. But it doesn't copy the null terminator,
neither zeromem the left unused spaces. It causes a problem because
`appendString` will copy itself which doesn't end with `\0` properly so
contaminated memory is copied instead.

```
var s = 12345\0

prepareAdd:

var s = 12345xxxxx\0

appendString:

var s = 1234512345x
```
2025-02-19 23:01:56 +01:00
..
2023-11-06 07:57:29 +01:00
2020-05-12 15:46:24 +02:00
2022-12-26 13:20:05 +01:00
2024-08-11 10:35:09 +08:00
2020-01-30 10:54:50 +01:00