All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Floris Bos <bos@je-eigen-domein.nl>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, Floris Bos <dev@noc-ps.com>
Subject: Re: [Qemu-devel] [PATCH] ide: Adds "model=s" option, allowing the user to override the default disk model name "QEMU HARDDISK"
Date: Mon, 12 Mar 2012 10:26:00 +0000	[thread overview]
Message-ID: <CAJSP0QVPewsKP9O=FuLgPd3vHakRasXMtrUSywFHH1ShZdka_g@mail.gmail.com> (raw)
In-Reply-To: <1331409387-18234-1-git-send-email-bos@je-eigen-domein.nl>

On Sat, Mar 10, 2012 at 7:56 PM, Floris Bos <bos@je-eigen-domein.nl> wrote:
> @@ -1885,6 +1885,22 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
>         snprintf(s->drive_serial_str, sizeof(s->drive_serial_str),
>                  "QM%05d", s->drive_serial);
>     }
> +    if (model) {
> +        strncpy(s->drive_model_str, model, sizeof(s->drive_model_str));

strncpy(3) does not NUL-terminate if the max length is reached.
Either you need to use pstrcpy() or specify sizeof(s->drive_model_str)
- 1 and make sure s->drive_model_str[40] = '\0'.

> @@ -146,6 +155,9 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
>     if (!dev->serial) {
>         dev->serial = g_strdup(s->drive_serial_str);
>     }
> +    if (!dev->model) {
> +        dev->model = g_strdup(s->drive_model_str);
> +    }

Seems this will never be freed but dev->serial has the same issue, so
this isn't new.

Stefan

  parent reply	other threads:[~2012-03-12 10:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-10 19:56 [Qemu-devel] [PATCH] ide: Adds "model=s" option, allowing the user to override the default disk model name "QEMU HARDDISK" Floris Bos
2012-03-11 11:56 ` Andreas Färber
2012-03-12 10:26 ` Stefan Hajnoczi [this message]
2012-03-12 11:30   ` Floris Bos / Maxnet
2012-03-12 11:38     ` Kevin Wolf
2012-03-12 11:57 ` Kevin Wolf
2012-03-12 12:09   ` Floris Bos / Maxnet
2012-03-12 12:45     ` Kevin Wolf

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='CAJSP0QVPewsKP9O=FuLgPd3vHakRasXMtrUSywFHH1ShZdka_g@mail.gmail.com' \
    --to=stefanha@gmail.com \
    --cc=bos@je-eigen-domein.nl \
    --cc=dev@noc-ps.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.