Fix potential overrun of static stack allocated array which stores

the rules. If an array is N elements large, we can only access
elements 0..(N-1).

MFC after:	1 week
Found with:	Coverity Prevent(tm)
This commit is contained in:
Christian S.J. Peron 2006-01-15 01:02:20 +00:00
parent 0bd03d1e35
commit e121674042
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154386

View File

@ -150,7 +150,7 @@ sysctl_rule(SYSCTL_HANDLER_ARGS)
return (EINVAL); return (EINVAL);
index = name[0]; index = name[0];
if (index > MAC_BSDEXTENDED_MAXRULES) if (index >= MAC_BSDEXTENDED_MAXRULES)
return (ENOENT); return (ENOENT);
ruleptr = NULL; ruleptr = NULL;