aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcao <[email protected]>2016-11-09 09:33:23 +0800
committerBrian Behlendorf <[email protected]>2016-11-08 17:33:23 -0800
commit010782be9197c8e1131be6220fff682c692a23eb (patch)
tree475240a2d2e61e1dd2f1a323e1487d6c5f8f5835
parentacc6d0e223e5dcff183a5dd52019cea1dabd981b (diff)
Fix coverity defects: CID 147586
CID 147586: function:allow_usage Type:out-of-bounds read Reviewed-by: Chunwei Chen <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: cao.xuewen <[email protected]> Closes #5364
-rw-r--r--cmd/zfs/zfs_main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index 8a49e31e5..8b6d9464c 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -4832,9 +4832,9 @@ allow_usage(boolean_t un, boolean_t requested, const char *msg)
(void) fprintf(fp, gettext("Usage: %s\n"), get_usage(un ? HELP_UNALLOW :
HELP_ALLOW));
(void) fprintf(fp, gettext("Options:\n"));
- for (i = 0; i < (un ? unallow_size : allow_size); i++) {
- const char *opt = opt_desc[i++];
- const char *optdsc = opt_desc[i];
+ for (i = 0; i < (un ? unallow_size : allow_size); i += 2) {
+ const char *opt = opt_desc[i];
+ const char *optdsc = opt_desc[i + 1];
(void) fprintf(fp, gettext(" %-10s %s\n"), opt, optdsc);
}