Skip to content

Commit

Permalink
haiku: Fixed SDL_SetClipboardText() allocating too much memory and cu…
Browse files Browse the repository at this point in the history
…tting text.

It allocated pointers instead of chars and passed a wrong size to SDL_strlcpy().
  • Loading branch information
philippwiesemann committed May 27, 2017
1 parent 3639895 commit 604a4b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/haiku/SDL_bclipboard.cc
Expand Up @@ -69,8 +69,8 @@ char *BE_GetClipboardText(_THIS) {
result = SDL_strdup("");
} else {
/* Copy the data and pass on to SDL */
result = (char*)SDL_calloc(1, sizeof(char*)*length);
SDL_strlcpy(result, text, length);
result = (char *)SDL_malloc((length + 1) * sizeof(char));
SDL_strlcpy(result, text, length + 1);
}

return result;
Expand Down

0 comments on commit 604a4b1

Please sign in to comment.