[Pkg-libvirt-commits] [libguestfs] 54/116: daemon: check xfs label lengths (RHBZ#1162966).

Hilko Bengen bengen at moszumanska.debian.org
Wed Nov 26 22:05:10 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.29.10-1
in repository libguestfs.

commit 57547dcdcfb27bdd988d8a561dc2178ea1d23517
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Wed Nov 12 09:50:59 2014 +0100

    daemon: check xfs label lengths (RHBZ#1162966).
    
    Similar to commit 52f9cd4882135910ea06e1e50ac6441d455c9ab1, but for xfs
    filesystems.
---
 daemon/daemon.h | 4 ++++
 daemon/labels.c | 6 ++++++
 daemon/xfs.c    | 6 ++++++
 3 files changed, 16 insertions(+)

diff --git a/daemon/daemon.h b/daemon/daemon.h
index 0ccbc9e..f442efd 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -253,6 +253,10 @@ extern void main_loop (int sock) __attribute__((noreturn));
 /*-- in xattr.c --*/
 extern int copy_xattrs (const char *src, const char *dest);
 
+/*-- in xfs.c --*/
+/* Documented in xfs_admin(8). */
+#define XFS_LABEL_MAX 12
+
 /* ordinary daemon functions use these to indicate errors
  * NB: you don't need to prefix the string with the current command,
  * it is added automatically by the client-side RPC stubs.
diff --git a/daemon/labels.c b/daemon/labels.c
index f417c57..cfcb4df 100644
--- a/daemon/labels.c
+++ b/daemon/labels.c
@@ -118,6 +118,12 @@ xfslabel (const char *device, const char *label)
     return -1;
   }
 
+  if (strlen (label) > XFS_LABEL_MAX) {
+    reply_with_error ("%s: xfs labels are limited to %d bytes",
+                      label, XFS_LABEL_MAX);
+    return -1;
+  }
+
   r = command (NULL, &err, str_xfs_admin, "-L", label, device, NULL);
   if (r == -1) {
     reply_with_error ("%s", err);
diff --git a/daemon/xfs.c b/daemon/xfs.c
index 725f7b3..687013b 100644
--- a/daemon/xfs.c
+++ b/daemon/xfs.c
@@ -498,6 +498,12 @@ do_xfs_admin (const char *device,
   }
 
   if (optargs_bitmask & GUESTFS_XFS_ADMIN_LABEL_BITMASK) {
+    if (strlen (label) > XFS_LABEL_MAX) {
+      reply_with_error ("%s: xfs labels are limited to %d bytes",
+                        label, XFS_LABEL_MAX);
+      return -1;
+    }
+
     ADD_ARG (argv, i, "-L");
     ADD_ARG (argv, i, label);
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list