sesutil: fix an out-of-bounds array access

sesutil would allow the user to toggle an LED that was one past the maximum
element.  If he tried, ENCIOC_GETELMSTAT would return EINVAL.

Reported by:	Coverity
Coverity CID:	1398940
MFC after:	2 weeks
Sponsored by:	Axcient
This commit is contained in:
Alan Somers 2019-11-12 23:03:52 +00:00
parent 051ed84f28
commit 691a834cb7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354664

View File

@ -247,7 +247,7 @@ sesled(int argc, char **argv, bool setfault)
}
if (isses) {
if (sesid > nobj) {
if (sesid >= nobj) {
close(fd);
xo_errx(EXIT_FAILURE,
"Requested SES ID does not exist");