From cf4cf12b4dc4dad0ba6f9e5ade26e7d0382f10ec Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 13 Nov 2010 14:54:52 +0000 Subject: [PATCH] inspect: Refuse to download software hive if it is huge. (cherry picked from commit e44cf42f362d793c47d892a18a6853d88abd6ecb) --- src/inspect.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/inspect.c b/src/inspect.c index 09dcecf..f4f13dd 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -875,6 +875,14 @@ check_windows_registry (guestfs_h *g, struct inspect_fs *fs) hive_h *h = NULL; hive_value_h *values = NULL; + /* Security: Refuse to download registry if it is huge. */ + int64_t size = guestfs_filesize (g, software_path); + if (size == -1 || size > 100000000) { + error (g, _("size of %s unreasonable (%" PRIi64 " bytes)"), + software_path, size); + goto out; + } + if (mkdtemp (dir) == NULL) { perrorf (g, "mkdtemp"); goto out; -- 1.8.3.1