Permalink
Browse files

Fix two off-by-ones.

Coverity CID:	1087999, 1011375
Approved by:	re (glebius)
Sponsored by:	FreeBSD Foundation
  • Loading branch information...
1 parent 089479f commit e282c243a6abd26e079c63e71f8570e8199e2dca @trasz trasz committed Oct 9, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 usr.sbin/ctladm/ctladm.c
View
@@ -3442,7 +3442,7 @@ cctl_islist_start_element(void *user_data, const char *name, const char **attr)
islist = (struct cctl_islist_data *)user_data;
cur_conn = islist->cur_conn;
islist->level++;
- if ((u_int)islist->level > (sizeof(islist->cur_sb) /
+ if ((u_int)islist->level >= (sizeof(islist->cur_sb) /
sizeof(islist->cur_sb[0])))
errx(1, "%s: too many nesting levels, %zd max", __func__,
sizeof(islist->cur_sb) / sizeof(islist->cur_sb[0]));
@@ -3848,7 +3848,7 @@ cctl_start_element(void *user_data, const char *name, const char **attr)
devlist = (struct cctl_devlist_data *)user_data;
cur_lun = devlist->cur_lun;
devlist->level++;
- if ((u_int)devlist->level > (sizeof(devlist->cur_sb) /
+ if ((u_int)devlist->level >= (sizeof(devlist->cur_sb) /
sizeof(devlist->cur_sb[0])))
errx(1, "%s: too many nesting levels, %zd max", __func__,
sizeof(devlist->cur_sb) / sizeof(devlist->cur_sb[0]));

0 comments on commit e282c24

Please sign in to comment.