Commit f32eca7d authored by Ashvini Varatharaj's avatar Ashvini Varatharaj Committed by Greg Kroah-Hartman

Staging: dgnc: avoiding buffer overflow

drivers/staging/dgnc/dgnc_neo.c:1969 neo_vpd() error: buffer overflow 'brd->vpd' 128 <= 128
drivers/staging/dgnc/dgnc_neo.c:1970 neo_vpd() warn: buffer overflow 'brd->vpd' 128 <= 130
drivers/staging/dgnc/dgnc_neo.c:1970 neo_vpd() warn: buffer overflow 'brd->vpd' 128 <= 130
Signed-off-by: default avatarAshvini Varatharaj <ashvinivaratharaj@gmail.com>
Reviewed-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e15b0c4e
...@@ -1965,7 +1965,7 @@ static void neo_vpd(struct dgnc_board *brd) ...@@ -1965,7 +1965,7 @@ static void neo_vpd(struct dgnc_board *brd)
} }
else { else {
/* Search for the serial number */ /* Search for the serial number */
for (i = 0; i < NEO_VPD_IMAGESIZE * 2; i++) { for (i = 0; i < NEO_VPD_IMAGEBYTES - 3; i++) {
if (brd->vpd[i] == 'S' && brd->vpd[i + 1] == 'N') { if (brd->vpd[i] == 'S' && brd->vpd[i + 1] == 'N') {
strncpy(brd->serial_num, &(brd->vpd[i + 3]), 9); strncpy(brd->serial_num, &(brd->vpd[i + 3]), 9);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment