changeset 2814:1ffbd73c54ba

mod_storage_xmlarchive: Add a sanity check to prevent reading from internal storage archives
author Kim Alvefur <zash@zash.se>
date Thu, 09 Nov 2017 13:41:36 +0100
parents e5ce64aee4ac
children d48d4d9ccae7
files mod_storage_xmlarchive/mod_storage_xmlarchive.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Thu Nov 09 13:34:05 2017 +0100
+++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Thu Nov 09 13:41:36 2017 +0100
@@ -269,7 +269,11 @@
 end
 
 function archive:dates(username)
-	return dm.list_load(username, self.host, self.store);
+	local dates, err = dm.list_load(username, self.host, self.store);
+	if not dates then return dates, err; end
+	assert(type(dates[1]) == "string" and type(dates[#dates]) == "string",
+		"Archive does not appear to be in xmlarchive format");
+	return dates;
 end
 
 local provider = {};