ecore_x: Fix buffer overrun
authorSebastian Dransfeld <sd@tango.flipp.net>
Sat, 7 Dec 2013 17:32:17 +0000 (18:32 +0100)
committerSebastian Dransfeld <sd@tango.flipp.net>
Sat, 7 Dec 2013 20:11:34 +0000 (21:11 +0100)
Use strncpy to prevent buffer overrun on buf, and '\0' terminate.

Fixes CID 1039584

src/lib/ecore_file/ecore_file_monitor_inotify.c

index bd78f92..e21e41c 100644 (file)
@@ -199,7 +199,10 @@ _ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask)
    if ((file) && (file[0]))
      snprintf(buf, sizeof(buf), "%s/%s", em->path, file);
    else
-     strcpy(buf, em->path);
+     {
+        strncpy(buf, em->path, sizeof(buf));
+        buf[PATH_MAX - 1] = 0;
+     }
    isdir = mask & IN_ISDIR;
 
 #if 0