From 010782be9197c8e1131be6220fff682c692a23eb Mon Sep 17 00:00:00 2001 From: cao Date: Wed, 9 Nov 2016 09:33:23 +0800 Subject: [PATCH] Fix coverity defects: CID 147586 CID 147586: function:allow_usage Type:out-of-bounds read Reviewed-by: Chunwei Chen Reviewed-by: Brian Behlendorf Signed-off-by: cao.xuewen Closes #5364 --- cmd/zfs/zfs_main.c | 6 +++--- 1 file 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); } -- 2.40.0