efreet: Check buffer size
authorSebastian Dransfeld <sebastian.dransfeld@sintef.no>
Mon, 14 Oct 2013 11:21:48 +0000 (13:21 +0200)
committerSebastian Dransfeld <sebastian.dransfeld@sintef.no>
Mon, 14 Oct 2013 11:21:48 +0000 (13:21 +0200)
CID 1039582, 1039583

src/lib/efreet/efreet_menu.c

index 739e9c1..b6103eb 100644 (file)
@@ -3177,7 +3177,10 @@ efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal, const char *path, const
         if (id)
             snprintf(buf2, sizeof(buf2), "%s-%s", id, fname);
         else
-            strcpy(buf2, fname);
+        {
+            strncpy(buf2, fname, PATH_MAX);
+            buf2[PATH_MAX - 1] = '\0';
+        }
 
         if (info->type == EINA_FILE_DIR)
         {
@@ -3285,7 +3288,10 @@ efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
         if (relative_path)
             snprintf(buf2, sizeof(buf2), "%s/%s", relative_path, fname);
         else
-            strcpy(buf2, fname);
+        {
+            strncpy(buf2, fname, PATH_MAX);
+            buf2[PATH_MAX - 1] = '\0';
+        }
 
         if (info->type == EINA_FILE_DIR)
             efreet_menu_directory_dir_scan(info->path, buf2, cache);