diff options
author | Igor Kozhukhov <[email protected]> | 2016-06-15 14:28:36 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-06-28 13:47:03 -0700 |
commit | eca7b76001a7d33f78bd98884aef8325bdbf98e7 (patch) | |
tree | bdcd0489c5a6c7840258c4c6063c9a4903bec256 /cmd/zvol_id/zvol_id_main.c | |
parent | 43e52eddb13d8accbd052fac9a242ce979531aa4 (diff) |
OpenZFS 6314 - buffer overflow in dsl_dataset_name
Reviewed by: George Wilson <[email protected]>
Reviewed by: Prakash Surya <[email protected]>
Reviewed by: Igor Kozhukhov <[email protected]>
Approved by: Dan McDonald <[email protected]>
Ported-by: Brian Behlendorf <[email protected]>
OpenZFS-issue: https://www.illumos.org/issues/6314
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d6160ee
Diffstat (limited to 'cmd/zvol_id/zvol_id_main.c')
-rw-r--r-- | cmd/zvol_id/zvol_id_main.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/cmd/zvol_id/zvol_id_main.c b/cmd/zvol_id/zvol_id_main.c index 8f0504ae9..6bd5113f1 100644 --- a/cmd/zvol_id/zvol_id_main.c +++ b/cmd/zvol_id/zvol_id_main.c @@ -39,14 +39,14 @@ static int ioctl_get_msg(char *var, int fd) { int error = 0; - char msg[ZFS_MAXNAMELEN]; + char msg[ZFS_MAX_DATASET_NAME_LEN]; error = ioctl(fd, BLKZNAME, msg); if (error < 0) { return (error); } - snprintf(var, ZFS_MAXNAMELEN, "%s", msg); + snprintf(var, ZFS_MAX_DATASET_NAME_LEN, "%s", msg); return (error); } @@ -54,7 +54,8 @@ int main(int argc, char **argv) { int fd, error = 0; - char zvol_name[ZFS_MAXNAMELEN], zvol_name_part[ZFS_MAXNAMELEN]; + char zvol_name[ZFS_MAX_DATASET_NAME_LEN]; + char zvol_name_part[ZFS_MAX_DATASET_NAME_LEN]; char *dev_name; struct stat64 statbuf; int dev_minor, dev_part; @@ -87,10 +88,11 @@ main(int argc, char **argv) return (errno); } if (dev_part > 0) - snprintf(zvol_name_part, ZFS_MAXNAMELEN, "%s-part%d", zvol_name, - dev_part); + snprintf(zvol_name_part, ZFS_MAX_DATASET_NAME_LEN, + "%s-part%d", zvol_name, dev_part); else - snprintf(zvol_name_part, ZFS_MAXNAMELEN, "%s", zvol_name); + snprintf(zvol_name_part, ZFS_MAX_DATASET_NAME_LEN, + "%s", zvol_name); for (i = 0; i < strlen(zvol_name_part); i++) { if (isblank(zvol_name_part[i])) |