diff options
| author | Luiz Capitulino | 2010-06-02 22:46:31 +0200 |
|---|---|---|
| committer | Kevin Wolf | 2010-06-04 15:20:54 +0200 |
| commit | 653dbec7c97cb51d19636423902719e5850da265 (patch) | |
| tree | 2b5e6b92e8a952d73cd3d657420a12b5c5eebbeb /blockdev.c | |
| parent | blockdev: Collect block device code in new blockdev.c (diff) | |
| download | qemu-653dbec7c97cb51d19636423902719e5850da265.tar.gz qemu-653dbec7c97cb51d19636423902719e5850da265.tar.xz qemu-653dbec7c97cb51d19636423902719e5850da265.zip | |
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>
Diffstat (limited to 'blockdev.c')
| -rw-r--r-- | blockdev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/blockdev.c b/blockdev.c index bd9783affd..642ce756ac 100644 --- a/blockdev.c +++ b/blockdev.c @@ -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) { |
