瀏覽代碼

rofs: bail if long filename is too long

Anonymous Maarten 2 月之前
父節點
當前提交
3dbfffabe7
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/physfs_archiver_rofs.c

+ 3 - 0
src/physfs_archiver_rofs.c

@@ -576,6 +576,9 @@ static ROFSentry *rofs_load_entry(ROFSinfo *info)
 	i = snprintf(entry.name, sizeof(entry.name), "%s/%s/%s", info->dirs[0].name,
 	i = snprintf(entry.name, sizeof(entry.name), "%s/%s/%s", info->dirs[0].name,
 			info->dirs[1].name, shortname);
 			info->dirs[1].name, shortname);
 
 
+	/* Bail if long filename is too long */
+	BAIL_IF(i >= (int)sizeof(entry.name), PHYSFS_ERR_OUT_OF_MEMORY, 0);
+
 	/* Now go read real file size */
 	/* Now go read real file size */
 	location = io->tell(io);
 	location = io->tell(io);