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:
parent
796d4eb89e
commit
641b7baa5b
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user