mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 04:07:45 +03:00
OpenZFS 6314 - buffer overflow in dsl_dataset_name
Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Prakash Surya <prakash.surya@delphix.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Approved by: Dan McDonald <danmcd@omniti.com> Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> OpenZFS-issue: https://www.illumos.org/issues/6314 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d6160ee
This commit is contained in:
committed by
Brian Behlendorf
parent
43e52eddb1
commit
eca7b76001
+10
-4
@@ -671,7 +671,7 @@ dmu_objset_refresh_ownership(objset_t *os, void *tag)
|
||||
{
|
||||
dsl_pool_t *dp;
|
||||
dsl_dataset_t *ds, *newds;
|
||||
char name[MAXNAMELEN];
|
||||
char name[ZFS_MAX_DATASET_NAME_LEN];
|
||||
|
||||
ds = os->os_dsl_dataset;
|
||||
VERIFY3P(ds, !=, NULL);
|
||||
@@ -895,6 +895,9 @@ dmu_objset_create_check(void *arg, dmu_tx_t *tx)
|
||||
if (strchr(doca->doca_name, '@') != NULL)
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
if (strlen(doca->doca_name) >= ZFS_MAX_DATASET_NAME_LEN)
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
|
||||
error = dsl_dir_hold(dp, doca->doca_name, FTAG, &pdd, &tail);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
@@ -981,6 +984,9 @@ dmu_objset_clone_check(void *arg, dmu_tx_t *tx)
|
||||
if (strchr(doca->doca_clone, '@') != NULL)
|
||||
return (SET_ERROR(EINVAL));
|
||||
|
||||
if (strlen(doca->doca_clone) >= ZFS_MAX_DATASET_NAME_LEN)
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
|
||||
error = dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
@@ -1020,7 +1026,7 @@ dmu_objset_clone_sync(void *arg, dmu_tx_t *tx)
|
||||
const char *tail;
|
||||
dsl_dataset_t *origin, *ds;
|
||||
uint64_t obj;
|
||||
char namebuf[MAXNAMELEN];
|
||||
char namebuf[ZFS_MAX_DATASET_NAME_LEN];
|
||||
|
||||
VERIFY0(dsl_dir_hold(dp, doca->doca_clone, FTAG, &pdd, &tail));
|
||||
VERIFY0(dsl_dataset_hold(dp, doca->doca_origin, FTAG, &origin));
|
||||
@@ -2047,7 +2053,7 @@ dmu_objset_get_user(objset_t *os)
|
||||
|
||||
/*
|
||||
* Determine name of filesystem, given name of snapshot.
|
||||
* buf must be at least MAXNAMELEN bytes
|
||||
* buf must be at least ZFS_MAX_DATASET_NAME_LEN bytes
|
||||
*/
|
||||
int
|
||||
dmu_fsname(const char *snapname, char *buf)
|
||||
@@ -2055,7 +2061,7 @@ dmu_fsname(const char *snapname, char *buf)
|
||||
char *atp = strchr(snapname, '@');
|
||||
if (atp == NULL)
|
||||
return (SET_ERROR(EINVAL));
|
||||
if (atp - snapname >= MAXNAMELEN)
|
||||
if (atp - snapname >= ZFS_MAX_DATASET_NAME_LEN)
|
||||
return (SET_ERROR(ENAMETOOLONG));
|
||||
(void) strlcpy(buf, snapname, atp - snapname + 1);
|
||||
return (0);
|
||||
|
||||
Reference in New Issue
Block a user