]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Don't use hard-coded 'size' value in snprintf()
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Fri, 30 Jun 2023 15:37:26 +0000 (21:07 +0530)
committerGitHub <noreply@github.com>
Fri, 30 Jun 2023 15:37:26 +0000 (08:37 -0700)
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 <behlendorf1@llnl.gov>
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Closes #15003

cmd/zfs/zfs_main.c

index e28f1d04f3503d87e17bd462db00b55ae9b14d5b..5ed25d1ea720549215e2e1516c11ea6fbd170710 100644 (file)
@@ -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);
                                }
                        }