From: Anthony Liguori <anthony@codemonkey.ws>
To: john cooper <john.cooper@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
Marc Haber <mh+qemu-devel@zugschlus.de>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 2/4] Add virtio disk identification support
Date: Thu, 03 Jun 2010 14:10:00 -0500 [thread overview]
Message-ID: <4C07FE08.9020708@codemonkey.ws> (raw)
In-Reply-To: <4BAAF58E.4050507@redhat.com>
On 03/25/2010 12:33 AM, john cooper wrote:
> Fix bug which truncated serial string to 8 bytes, nul terminate.
>
> Signed-off-by: john cooper<john.cooper@redhat.com>
> ---
>
> diff --git a/vl.c b/vl.c
> index d69250c..b74cbba 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1162,7 +1162,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);
>
You need to explicitly add a null terminator. Far better to just never
use strncpy().
Regards,
Anthony Liguori
> QTAILQ_INSERT_TAIL(&drives, dinfo, next);
>
> switch(type) {
>
>
next prev parent reply other threads:[~2010-06-03 19:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-25 5:33 [Qemu-devel] [PATCH 2/4] Add virtio disk identification support john cooper
2010-06-03 19:10 ` Anthony Liguori [this message]
2010-06-04 6:34 ` [Qemu-devel] " john cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C07FE08.9020708@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=john.cooper@redhat.com \
--cc=mh+qemu-devel@zugschlus.de \
--cc=qemu-devel@nongnu.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).