block: Fix serial number assignment
PATCH 1/1 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.
--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
vl.c +1 -1
@@ -1060,7 +1060,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque, 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) {
Signature · 1 line
1.7.1.231.gd0b16
Quoted 16 lines · Luiz Capitulino
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 <[email protected]>--- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)vl.c +0
-0
vl.c DriveInfo *drive_init(QemuOpts *opts, void *opaque, · line 1066
Quoted 8 lines
vl.c +1
-1@@ -1060,7 +1060,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque, 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) {
Correct, because dinfo->serial[] is zero-initialized.
Patch conflicts with my "blockdev: Collect block device code in new blockdev.c", but resolution is trivial.
Kevin Wolf
AppliedAm 02.06.2010 22:46, schrieb Luiz Capitulino:
Quoted 7 lines
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 <[email protected]>
Thanks, applied to the block branch.
Kevin