ringabout
5584885226
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
```
(cherry picked from commit 1f07fdd2dc )
2025-03-03 14:03:17 +01:00
..
2023-09-09 21:11:45 +02:00
2025-01-14 13:12:39 +01:00
2025-01-15 15:31:04 +01:00
2025-03-03 14:02:48 +01:00
2024-09-17 21:28:54 +02:00
2023-04-04 12:18:43 +02:00
2017-01-31 13:08:47 +01:00
2022-09-28 15:28:45 -04:00
2022-12-01 13:34:00 +01:00
2025-01-14 07:32:40 +01:00
2025-01-14 07:32:40 +01:00
2025-01-14 07:32:40 +01:00
2023-10-11 17:44:14 +02:00
2025-01-14 13:15:55 +01:00
2025-01-14 13:23:18 +01:00
2024-07-26 20:45:52 +02:00
2025-03-03 13:59:39 +01:00
2021-05-01 11:10:40 +02:00
2022-04-07 17:38:01 -04:00
2023-04-11 21:20:20 +02:00
2022-11-09 16:22:55 +01:00
2025-01-14 13:12:39 +01:00
2025-01-14 13:12:39 +01:00
2025-01-14 07:33:01 +01:00
2024-01-27 07:57:07 +01:00
2022-09-28 15:28:45 -04:00
2024-02-21 16:58:30 +01:00
2023-11-06 07:57:29 +01:00
2022-08-24 13:38:30 +02:00
2023-03-22 22:05:20 +01:00
2022-11-05 10:58:57 +01:00
2020-05-12 15:46:24 +02:00
2023-10-30 17:03:04 +01:00
2022-10-29 18:11:40 +02:00
2023-10-30 17:03:04 +01:00
2024-08-28 20:46:36 +02:00
2022-12-26 13:20:05 +01:00
2021-08-13 09:35:48 +02:00
2024-08-01 12:27:10 +08:00
2025-01-14 13:12:39 +01:00
2023-10-11 17:18:54 +02:00
2023-11-04 08:52:30 +01:00
2025-01-14 07:47:13 +01:00
2025-01-14 13:12:39 +01:00
2023-10-11 17:44:14 +02:00
2022-11-05 10:58:57 +01:00
2022-11-05 10:58:57 +01:00
2024-08-11 10:35:09 +08:00
2025-01-14 13:12:39 +01:00
2023-08-08 05:55:18 -04:00
2022-12-01 12:48:47 +08:00
2022-10-11 09:17:09 +02:00
2025-01-14 09:08:40 +01:00
2021-08-13 09:35:48 +02:00
2025-01-14 13:23:18 +01:00
2024-02-20 07:28:45 +01:00
2024-07-26 20:45:52 +02:00
2020-10-19 14:50:06 +02:00
2025-01-20 12:48:37 +01:00
2023-04-17 20:55:22 +02:00
2023-08-15 23:31:44 +02:00
2022-10-11 09:17:09 +02:00
2025-01-14 13:12:39 +01:00
2025-03-03 14:03:17 +01:00
2025-01-14 07:32:40 +01:00
2021-11-11 19:07:08 +01:00
2023-07-31 10:58:59 +02:00
2025-01-14 13:12:39 +01:00
2020-01-30 10:54:50 +01:00