* [Qemu-devel] [PATCH] block: Fix serial number assignment
@ 2010-06-02 20:46 Luiz Capitulino
2010-06-03 7:00 ` Markus Armbruster
2010-06-04 10:12 ` [Qemu-devel] " Kevin Wolf
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Capitulino @ 2010-06-02 20:46 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
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>
---
vl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/vl.c b/vl.c
index 417554f..3de2166 100644
--- a/vl.c
+++ b/vl.c
@@ -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) {
--
1.7.1.231.gd0b16
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Fix serial number assignment
2010-06-02 20:46 [Qemu-devel] [PATCH] block: Fix serial number assignment Luiz Capitulino
@ 2010-06-03 7:00 ` Markus Armbruster
2010-06-04 10:12 ` [Qemu-devel] " Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2010-06-03 7:00 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: kwolf, qemu-devel
Luiz Capitulino <lcapitulino@redhat.com> writes:
> 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>
> ---
> vl.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 417554f..3de2166 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH] block: Fix serial number assignment
2010-06-02 20:46 [Qemu-devel] [PATCH] block: Fix serial number assignment Luiz Capitulino
2010-06-03 7:00 ` Markus Armbruster
@ 2010-06-04 10:12 ` Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2010-06-04 10:12 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: qemu-devel
Am 02.06.2010 22:46, schrieb 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 <lcapitulino@redhat.com>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-04 10:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-02 20:46 [Qemu-devel] [PATCH] block: Fix serial number assignment Luiz Capitulino
2010-06-03 7:00 ` Markus Armbruster
2010-06-04 10:12 ` [Qemu-devel] " Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).