summaryrefslogtreecommitdiffstats
path: root/src/inspect.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-11-13 14:54:52 +0000
committerRichard W.M. Jones <rjones@redhat.com>2010-11-13 14:54:52 +0000
commite44cf42f362d793c47d892a18a6853d88abd6ecb (patch)
treeb9de62175feb44ea260199802e38b9a573a72dcc /src/inspect.c
parent692f127447d399db21c2e93026d4d2b0ac1839d1 (diff)
downloadlibguestfs-e44cf42f362d793c47d892a18a6853d88abd6ecb.tar.gz
libguestfs-e44cf42f362d793c47d892a18a6853d88abd6ecb.tar.xz
libguestfs-e44cf42f362d793c47d892a18a6853d88abd6ecb.zip
inspect: Refuse to download software hive if it is huge.
Diffstat (limited to 'src/inspect.c')
-rw-r--r--src/inspect.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/inspect.c b/src/inspect.c
index d0041c8e..bd6d1895 100644
--- a/src/inspect.c
+++ b/src/inspect.c
@@ -950,6 +950,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;