1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

Fix two off-by-ones.

Coverity CID:	1087999, 1011375
Approved by:	re (glebius)
Sponsored by:	FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2013-10-09 12:30:52 +00:00
parent 846c5adb77
commit bd32ec0619
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256191

View File

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