Commit 41e5586
committed
Use memmove in String::remove
Before, it used strncpy, but that has undefined behaviour when the
source and destination strings overlap. memove is guaranteed to work
correctly in this case.
Note that memmove simply copies all bytes, whereas strncpy stopped at
the first nul-byte. This measn this commit also makes remove work for
strings that contain embedded nul bytes.1 parent 8073c48 commit 41e5586
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
698 | | - | |
| 698 | + | |
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
| |||
0 commit comments