Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicki Myers <antihc3@gmail.com>2008-03-20 15:27:15 +0300
committerRicki Myers <antihc3@gmail.com>2008-03-20 15:27:15 +0300
commit8bf91e42e71c3db43d6f19187a59b58618b819a9 (patch)
treed626cf659d42b8c1485f89d6074414f6554c30d3
parenta4aee00c6120af59848f0bc10096b98291cae43f (diff)
Fix for Crash on X11. Buffer was not the correct size. So strcpy would blow-up.
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 0329241045f..6484d767b81 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -959,7 +959,7 @@ getClipboard(int flag
Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
owner = XGetSelectionOwner(m_display, Primary_atom);
if (owner == m_window) {
- data = (unsigned char*) malloc(strlen(txt_cut_buffer));
+ data = (unsigned char*) malloc(strlen(txt_cut_buffer)+1);
strcpy((char*)data, txt_cut_buffer);
return (GHOST_TUns8*)data;
} else if (owner == None) {
@@ -969,7 +969,7 @@ getClipboard(int flag
Primary_atom = XInternAtom(m_display, "PRIMARY", False);
owner = XGetSelectionOwner(m_display, Primary_atom);
if (owner == m_window) {
- data = (unsigned char*) malloc(strlen(txt_select_buffer));
+ data = (unsigned char*) malloc(strlen(txt_select_buffer)+1);
strcpy((char*)data, txt_select_buffer);
return (GHOST_TUns8*)data;
} else if (owner == None) {
@@ -991,7 +991,7 @@ getClipboard(int flag
if(xevent.type == SelectionNotify) {
if(XGetWindowProperty(m_display, m_window, xevent.xselection.property, 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
if (data) {
- tmp_data = (unsigned char*) malloc(strlen((char*)data));
+ tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
strcpy((char*)tmp_data, (char*)data);
XFree(data);
return (GHOST_TUns8*)tmp_data;
@@ -1016,13 +1016,13 @@ GHOST_TInt8 *buffer, int flag) const
Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
if(txt_cut_buffer) { free((void*)txt_cut_buffer); }
- txt_cut_buffer = (char*) malloc(strlen(buffer));
+ txt_cut_buffer = (char*) malloc(strlen(buffer)+1);
strcpy(txt_cut_buffer, buffer);
} else {
Primary_atom = XInternAtom(m_display, "PRIMARY", False);
if(txt_select_buffer) { free((void*)txt_select_buffer); }
- txt_select_buffer = (char*) malloc(strlen(buffer));
+ txt_select_buffer = (char*) malloc(strlen(buffer)+1);
strcpy(txt_select_buffer, buffer);
}