Fix coverity defects: CID 147586

CID 147586: function:allow_usage Type:out-of-bounds read

Reviewed-by: Chunwei Chen <david.chen@osnexus.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn>
Closes #5364
This commit is contained in:
cao 2016-11-09 09:33:23 +08:00 committed by Brian Behlendorf
parent acc6d0e223
commit 010782be91

View File

@ -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);
}