mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-01-26 00:49:38 +07:00
scsi_id: prevent buffer overflow in check_fill_0x83_prespc3()
see https://bugzilla.redhat.com/show_bug.cgi?id=516920
This commit is contained in:
parent
91554cf9a1
commit
676cea155a
@ -578,11 +578,12 @@ static int check_fill_0x83_prespc3(struct udev *udev,
|
||||
/* serial has been memset to zero before */
|
||||
j = strlen(serial); /* j = 1; */
|
||||
|
||||
for (i = 0; i < page_83[3]; ++i) {
|
||||
for (i = 0; (i < page_83[3]) && (j < max_len-3); ++i) {
|
||||
serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4];
|
||||
serial[j++] = hex_str[ page_83[4+i] & 0x0f];
|
||||
}
|
||||
strcpy(serial_short, serial);
|
||||
serial[max_len-1] = 0;
|
||||
strncpy(serial_short, serial, max_len-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user