efl_io_model: fix not to cause memory overflow by strcpy 86/199986/2
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Mon, 18 Feb 2019 04:48:39 +0000 (13:48 +0900)
committerJaehyun Cho <jae_hyun.cho@samsung.com>
Mon, 18 Feb 2019 06:18:24 +0000 (06:18 +0000)
Since the destination string size is EINA_PATH_MAX, the string is copied
up to EINA_PATH_MAX size.

Change-Id: Ibc0c9b830af3b0befd648cea3dd3288212358ec1

src/lib/eio/efl_io_model.c

index a142090..76cc7ab 100644 (file)
@@ -111,7 +111,7 @@ _efl_model_evt_added_ecore_cb(void *data, int type, void *event)
         info.name_start = mi->name_start;
         info.name_length = mi->name_length;
         info.type = EINA_FILE_UNKNOWN;
-        strcpy(info.path, mi->path);
+        strncpy(info.path, mi->path, (EINA_PATH_MAX - 1));
 
         if (!pd->filter.cb(pd->filter.data, obj, &info))
           {