jedec_dimm: fix array overrun

Coverity detected the overrunning of sc->part_str.

Submitted by:	bret_ketchum@dell.com
Reported by:	Coverity
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D26145
This commit is contained in:
Eric van Gyzen 2020-08-31 15:03:23 +00:00
parent 796d4eb89e
commit 641b7baa5b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364989

View File

@ -795,7 +795,7 @@ jedec_dimm_field_to_str(struct jedec_dimm_softc *sc, char *dst, size_t dstsz,
/* If we're dealing with ASCII, convert trailing spaces to NULs. */
if (ascii) {
for (i = dstsz; i > 0; i--) {
for (i = dstsz - 1; i > 0; i--) {
if (dst[i] == ' ') {
dst[i] = 0;
} else if (dst[i] == 0) {