From 604a4b1b30471be2a4b2401e0d1603917b75d1b3 Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Sat, 27 May 2017 23:30:21 +0200 Subject: [PATCH] haiku: Fixed SDL_SetClipboardText() allocating too much memory and cutting text. It allocated pointers instead of chars and passed a wrong size to SDL_strlcpy(). --- src/video/haiku/SDL_bclipboard.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/haiku/SDL_bclipboard.cc b/src/video/haiku/SDL_bclipboard.cc index a49908f5c..8c4d21052 100644 --- a/src/video/haiku/SDL_bclipboard.cc +++ b/src/video/haiku/SDL_bclipboard.cc @@ -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;