qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 27/27] block: Fix serial number assignment


From: Kevin Wolf
Subject: [Qemu-devel] [PATCH 27/27] block: Fix serial number assignment
Date: Fri, 4 Jun 2010 18:33:15 +0200

From: Luiz Capitulino <address@hidden>

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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
 blockdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index bd9783a..642ce75 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) {
-- 
1.6.6.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]