From eca7b76001a7d33f78bd98884aef8325bdbf98e7 Mon Sep 17 00:00:00 2001 From: Igor Kozhukhov Date: Wed, 15 Jun 2016 14:28:36 -0700 Subject: OpenZFS 6314 - buffer overflow in dsl_dataset_name Reviewed by: George Wilson Reviewed by: Prakash Surya Reviewed by: Igor Kozhukhov Approved by: Dan McDonald Ported-by: Brian Behlendorf OpenZFS-issue: https://www.illumos.org/issues/6314 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d6160ee --- include/sys/dsl_dir.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'include/sys/dsl_dir.h') diff --git a/include/sys/dsl_dir.h b/include/sys/dsl_dir.h index a025c50a0..fb299684c 100644 --- a/include/sys/dsl_dir.h +++ b/include/sys/dsl_dir.h @@ -112,7 +112,7 @@ struct dsl_dir { int64_t dd_space_towrite[TXG_SIZE]; /* protected by dd_lock; keep at end of struct for better locality */ - char dd_myname[MAXNAMELEN]; + char dd_myname[ZFS_MAX_DATASET_NAME_LEN]; }; static inline dsl_dir_phys_t * @@ -176,11 +176,10 @@ boolean_t dsl_dir_is_zapified(dsl_dir_t *dd); #ifdef ZFS_DEBUG #define dprintf_dd(dd, fmt, ...) do { \ if (zfs_flags & ZFS_DEBUG_DPRINTF) { \ - char *__ds_name = kmem_alloc(MAXNAMELEN + strlen(MOS_DIR_NAME) + 1, \ - KM_SLEEP); \ + char *__ds_name = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); \ dsl_dir_name(dd, __ds_name); \ dprintf("dd=%s " fmt, __ds_name, __VA_ARGS__); \ - kmem_free(__ds_name, MAXNAMELEN + strlen(MOS_DIR_NAME) + 1); \ + kmem_free(__ds_name, ZFS_MAX_DATASET_NAME_LEN); \ } \ _NOTE(CONSTCOND) } while (0) #else -- cgit v1.2.3