Fix improper null termination when stripping clipboard text
This commit is contained in:
parent
f2bcb49478
commit
0870dd15a8
1 changed files with 3 additions and 1 deletions
|
|
@ -107,7 +107,9 @@ void SdlInputHandler::performSpecialKeyCombo(KeyCombo combo)
|
|||
// each newline in the source, so we fix up any CRLFs into just a single LF.
|
||||
for (char* c = text; *c != 0; c++) {
|
||||
if (*c == '\r' && *(c + 1) == '\n') {
|
||||
memmove(c, c + 1, strlen(c) - 1);
|
||||
// We're using strlen() rather than strlen() - 1 since we need to add 1
|
||||
// to copy the null terminator which is not included in strlen()'s count.
|
||||
memmove(c, c + 1, strlen(c));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue