qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Prasad J Pandit <pjp@fedoraproject.org>
Subject: [Qemu-devel] [PULL 06/13] scsi: megasas: null terminate bios version buffer
Date: Tue,  7 Jun 2016 19:08:34 +0200	[thread overview]
Message-ID: <1465319317-50519-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1465319317-50519-1-git-send-email-pbonzini@redhat.com>

From: Prasad J Pandit <pjp@fedoraproject.org>

While reading information via 'megasas_ctrl_get_info' routine,
a local bios version buffer isn't null terminated. Add the
terminating null byte to avoid any OOB access.

Reported-by: Li Qiang <liqiang6-s@360.cn>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/megasas.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index cc66d36..a9ffc32 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -773,6 +773,7 @@ static int megasas_ctrl_get_info(MegasasState *s, MegasasCmd *cmd)
 
         ptr = memory_region_get_ram_ptr(&pci_dev->rom);
         memcpy(biosver, ptr + 0x41, 31);
+        biosver[31] = 0;
         memcpy(info.image_component[1].name, "BIOS", 4);
         memcpy(info.image_component[1].version, biosver,
                strlen((const char *)biosver));
-- 
1.8.3.1

  reply	other threads:[~2016-06-07 17:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 17:08 [Qemu-devel] [PULL v3 00/13] Misc changes for 2016-06-06 Paolo Bonzini
2016-06-07 17:08 ` Paolo Bonzini [this message]
2016-06-07 17:08 ` [Qemu-devel] [PULL 08/13] Makefile: add dependency on scripts/create_config Paolo Bonzini
2016-06-07 17:08 ` [Qemu-devel] [PULL 09/13] Makefile: add dependency on scripts/make_device_config.sh Paolo Bonzini
2016-06-07 17:08 ` [Qemu-devel] [PULL 10/13] Makefile: add dependency on scripts/hxtool Paolo Bonzini
2016-06-08 15:04 ` [Qemu-devel] [PULL v3 00/13] Misc changes for 2016-06-06 Peter Maydell

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=1465319317-50519-2-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=pjp@fedoraproject.org \
    --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 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).