[3.0] Fixed crash issue by buffer overflow 89/108389/3 accepted/tizen/3.0/common/20170109.200037 accepted/tizen/3.0/ivi/20170109.003650 accepted/tizen/3.0/mobile/20170109.003500 accepted/tizen/3.0/tv/20170109.003603 accepted/tizen/3.0/wearable/20170109.003627 submit/tizen_3.0/20170106.084214
authorsuhyung Eom <suhyung.eom@samsung.com>
Wed, 4 Jan 2017 07:39:54 +0000 (16:39 +0900)
committersuhyung Eom <suhyung.eom@samsung.com>
Wed, 4 Jan 2017 08:41:53 +0000 (17:41 +0900)
Signed-off-by: suhyung Eom <suhyung.eom@samsung.com>
Change-Id: I81b72f672528d173c53299575887fbdc9fc44dcc

adaptors/ecore/wayland/clipboard-impl-ecore-wl.cpp

index aad03a3..684f61b 100644 (file)
@@ -39,7 +39,7 @@
 #endif /* CBHM_DBUS_INTERFACE */
 
 #define CLIPBOARD_STR  "CLIPBOARD_STR"
-#define CLIPBOARD_BUFFER_SIZE 512
+#define CLIPBOARD_BUFFER_SIZE 3000
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // Clipboard
@@ -143,9 +143,7 @@ struct Clipboard::Impl
   {
     Ecore_Wl_Event_Selection_Data_Ready *ev = (Ecore_Wl_Event_Selection_Data_Ready *)event;
 
-    strncpy(mReceiveBuf, (char *)ev->data, ev->len);
-    mReceiveBuf[ev->len] = '\0';
-    return (char *)mReceiveBuf;
+    return (char *)ev->data;
   }
 
   int GetCount()
@@ -214,8 +212,7 @@ struct Clipboard::Impl
   Eldbus_Proxy *eldbus_proxy;
   Eldbus_Connection *cbhm_conn;
 
-  char mSendBuf[CLIPBOARD_BUFFER_SIZE];
-  char mReceiveBuf[CLIPBOARD_BUFFER_SIZE];
+  char mSendBuf[CLIPBOARD_BUFFER_SIZE+1];
   bool mVisible;
   bool mIsFirstTimeHidden;
 };