aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorArshad Hussain <[email protected]>2023-06-30 21:07:26 +0530
committerGitHub <[email protected]>2023-06-30 08:37:26 -0700
commit6052060c133d0caed0e1bc3ec2c057f8c33e5f7a (patch)
tree8e7313274eedd4bb39343627bd4b2e204d99b1d2 /cmd
parenteda32dca92a854e5d23877166188c476c2ac75bd (diff)
Don't use hard-coded 'size' value in snprintf()
This patch changes the passing of "size" to snprintf from hard-coded (openended) to sizeof(errbuf). This is bringing to standard with rest of the code where- ever 'errbuf' is used. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Arshad Hussain <[email protected]> Closes #15003
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index e28f1d04f..5ed25d1ea 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -6057,8 +6057,8 @@ construct_fsacl_list(boolean_t un, struct allow_opts *opts, nvlist_t **nvlp)
if (p != NULL)
rid = p->pw_uid;
else if (*endch != '\0') {
- (void) snprintf(errbuf, 256, gettext(
- "invalid user %s\n"), curr);
+ (void) snprintf(errbuf, sizeof (errbuf),
+ gettext("invalid user %s\n"), curr);
allow_usage(un, B_TRUE, errbuf);
}
} else if (opts->group) {
@@ -6071,8 +6071,9 @@ construct_fsacl_list(boolean_t un, struct allow_opts *opts, nvlist_t **nvlp)
if (g != NULL)
rid = g->gr_gid;
else if (*endch != '\0') {
- (void) snprintf(errbuf, 256, gettext(
- "invalid group %s\n"), curr);
+ (void) snprintf(errbuf, sizeof (errbuf),
+ gettext("invalid group %s\n"),
+ curr);
allow_usage(un, B_TRUE, errbuf);
}
} else {
@@ -6097,8 +6098,9 @@ construct_fsacl_list(boolean_t un, struct allow_opts *opts, nvlist_t **nvlp)
who_type = ZFS_DELEG_GROUP;
rid = g->gr_gid;
} else {
- (void) snprintf(errbuf, 256, gettext(
- "invalid user/group %s\n"), curr);
+ (void) snprintf(errbuf, sizeof (errbuf),
+ gettext("invalid user/group %s\n"),
+ curr);
allow_usage(un, B_TRUE, errbuf);
}
}