Revision: 14183
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14183
Author:   themyers
Date:     2008-03-20 13:27:15 +0100 (Thu, 20 Mar 2008)

Log Message:
-----------
Fix for Crash on X11.  Buffer was not the correct size. So strcpy would blow-up.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp       2008-03-20 
11:31:52 UTC (rev 14182)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp       2008-03-20 
12:27:15 UTC (rev 14183)
@@ -959,7 +959,7 @@
                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 @@
                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 @@
                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 @@
                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);
        }
        


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to