diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2010-11-13 14:49:37 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2010-11-13 14:49:37 +0000 |
commit | 692f127447d399db21c2e93026d4d2b0ac1839d1 (patch) | |
tree | 582e7509091d9debafe00321bf2584606dc0a0f5 | |
parent | 528cd8f64176ca50f5b82db5682b0ee31833b162 (diff) | |
download | libguestfs-692f127447d399db21c2e93026d4d2b0ac1839d1.tar.gz libguestfs-692f127447d399db21c2e93026d4d2b0ac1839d1.tar.xz libguestfs-692f127447d399db21c2e93026d4d2b0ac1839d1.zip |
inspect: Refuse to parse /etc/fstab if it is huge.
-rw-r--r-- | src/inspect.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/inspect.c b/src/inspect.c index 3c4c619b..d0041c8e 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -629,6 +629,14 @@ static int check_fstab (guestfs_h *g, struct inspect_fs *fs) { int r; + int64_t size; + + /* Security: Refuse to do this if /etc/fstab is huge. */ + size = guestfs_filesize (g, "/etc/fstab"); + if (size == -1 || size > 100000) { + error (g, _("size of /etc/fstab unreasonable (%" PRIi64 " bytes)"), size); + return -1; + } /* XXX What if !feature_available (g, "augeas")? */ if (guestfs_aug_init (g, "/", 16|32) == -1) |