File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
usr/src/uts/common/fs/zfs Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -2099,12 +2099,14 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)
2099
2099
int err ;
2100
2100
uint64_t unused ;
2101
2101
uint64_t ss_mv_cnt ;
2102
+ size_t max_snap_len ;
2102
2103
2103
2104
err = promote_hold (ddpa , dp , FTAG );
2104
2105
if (err != 0 )
2105
2106
return (err );
2106
2107
2107
2108
hds = ddpa -> ddpa_clone ;
2109
+ max_snap_len = MAXNAMELEN - strlen (ddpa -> ddpa_clonename ) - 1 ;
2108
2110
2109
2111
if (dsl_dataset_phys (hds )-> ds_flags & DS_FLAG_NOPROMOTE ) {
2110
2112
promote_rele (ddpa , FTAG );
@@ -2168,6 +2170,10 @@ dsl_dataset_promote_check(void *arg, dmu_tx_t *tx)
2168
2170
2169
2171
/* Check that the snapshot name does not conflict */
2170
2172
VERIFY0 (dsl_dataset_get_snapname (ds ));
2173
+ if (strlen (ds -> ds_snapname ) >= max_snap_len ) {
2174
+ err = SET_ERROR (ENAMETOOLONG );
2175
+ goto out ;
2176
+ }
2171
2177
err = dsl_dataset_snap_lookup (hds , ds -> ds_snapname , & val );
2172
2178
if (err == 0 ) {
2173
2179
(void ) strcpy (ddpa -> err_ds , snap -> ds -> ds_snapname );
You can’t perform that action at this time.
0 commit comments