mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
block: Fix serial number assignment
We should use 'dinfo->serial' length, 'serial' is a pointer, so the serial number length is currently limited to the pointer size. This fixes https://bugs.launchpad.net/qemu/+bug/584143 and is also valid for stable. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
666daa6823
commit
653dbec7c9
1 changed files with 1 additions and 1 deletions
|
@ -422,7 +422,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error)
|
|||
dinfo->on_write_error = on_write_error;
|
||||
dinfo->opts = opts;
|
||||
if (serial)
|
||||
strncpy(dinfo->serial, serial, sizeof(serial));
|
||||
strncpy(dinfo->serial, serial, sizeof(dinfo->serial) - 1);
|
||||
QTAILQ_INSERT_TAIL(&drives, dinfo, next);
|
||||
|
||||
switch(type) {
|
||||
|
|
Loading…
Reference in a new issue