mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
daemon: check xfs label lengths (RHBZ#1162966).
Similar to commit 52f9cd4882, but for xfs
filesystems.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user