Files
Nim/tests/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
..
2018-12-11 21:23:22 +01:00
2019-10-03 18:36:18 +02:00
2022-09-23 13:05:05 +02:00
2023-07-29 10:57:03 +02:00
2023-07-29 10:57:03 +02:00
2019-07-06 21:20:16 +02:00
2020-12-27 14:45:57 +01:00
2020-04-21 15:05:21 +02:00
2023-04-08 11:42:17 +02:00