diff options
author | loli10K <ezomori.nozomu@gmail.com> | 2017-10-09 19:06:14 +0200 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2017-10-23 10:34:29 -0400 |
commit | f37ae9a714b97eca91c74c680c20c750c7cf5c02 (patch) | |
tree | 417cbc17a3f0e987e889eb77450ac63e06033d36 | |
parent | 0c950529ae1558b3b4983f2eb6d4dd664ddfa424 (diff) | |
download | illumos-joyent-f37ae9a714b97eca91c74c680c20c750c7cf5c02.tar.gz |
8713 Buffer overflow in dsl_dataset_name()
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/common/zfs/zfs_namecheck.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr/src/common/zfs/zfs_namecheck.c b/usr/src/common/zfs/zfs_namecheck.c index 950d41f353..0997512526 100644 --- a/usr/src/common/zfs/zfs_namecheck.c +++ b/usr/src/common/zfs/zfs_namecheck.c @@ -44,6 +44,7 @@ #include <string.h> #endif +#include <sys/dsl_dir.h> #include <sys/param.h> #include <sys/nvpair.h> #include "zfs_namecheck.h" @@ -301,8 +302,14 @@ pool_namecheck(const char *pool, namecheck_err_t *why, char *what) /* * Make sure the name is not too long. + * If we're creating a pool with version >= SPA_VERSION_DSL_SCRUB (v11) + * we need to account for additional space needed by the origin ds which + * will also be snapshotted: "poolname"+"/"+"$ORIGIN"+"@"+"$ORIGIN". + * Play it safe and enforce this limit even if the pool version is < 11 + * so it can be upgraded without issues. */ - if (strlen(pool) >= ZFS_MAX_DATASET_NAME_LEN) { + if (strlen(pool) >= (ZFS_MAX_DATASET_NAME_LEN - 2 - + strlen(ORIGIN_DIR_NAME) * 2)) { if (why) *why = NAME_ERR_TOOLONG; return (-1); |