mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
ide: Change serial number strncpy() to pstrcpy()
strncpy may not null-terminate the destination string. Cc: kwolf@redhat.com Signed-off-by: Floris Bos <dev@noc-ps.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
27e0c9a1bb
commit
aa2c91bdfe
2 changed files with 4 additions and 3 deletions
|
@ -1879,7 +1879,7 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
|
|||
}
|
||||
}
|
||||
if (serial) {
|
||||
strncpy(s->drive_serial_str, serial, sizeof(s->drive_serial_str));
|
||||
pstrcpy(s->drive_serial_str, sizeof(s->drive_serial_str), serial);
|
||||
} else {
|
||||
snprintf(s->drive_serial_str, sizeof(s->drive_serial_str),
|
||||
"QM%05d", s->drive_serial);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue