]> Git Repo - qemu.git/commitdiff
block: Fix serial number assignment
authorLuiz Capitulino <[email protected]>
Wed, 2 Jun 2010 20:46:31 +0000 (17:46 -0300)
committerKevin Wolf <[email protected]>
Fri, 4 Jun 2010 13:20:54 +0000 (15:20 +0200)
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]>
Signed-off-by: Kevin Wolf <[email protected]>
blockdev.c

index bd9783affde17065534f0bb4f5cce8bad760df9b..642ce756accdebedf9c2f704f6af6cea093b9cbf 100644 (file)
@@ -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) {
This page took 0.029011 seconds and 4 git commands to generate.