qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Kővágó, Zoltán" <dirty.ice.hu@gmail.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, Maxim Levitsky <mlevitsk@redhat.com>
Subject: [Qemu-devel] [PATCH v2 1/4] audio: fix invalid malloc size in audio_create_pdos
Date: Mon, 26 Aug 2019 21:59:01 +0200	[thread overview]
Message-ID: <7808bc816ba7da8b8de8a214713444d85f7af3c6.1566847960.git.DirtY.iCE.hu@gmail.com> (raw)
In-Reply-To: <cover.1566847960.git.DirtY.iCE.hu@gmail.com>

The code used sizeof(AudiodevAlsaPerDirectionOptions) instead of the
appropriate per direction options for the audio backend.  If the size of
the actual audiodev's per direction options are larger than alsa's, it
could cause a buffer overflow.

However, alsa has three fields in per direction options: a string, an
uint32 and a bool.  Oss has the same fields, coreaudio has a single
uint32, paaudio has a string and an uint32, all other backends only use
the common options, so currently no per direction options struct should
be larger than alsa's.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
---
 audio/audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/audio/audio.c b/audio/audio.c
index 7d715332c9..ae335dbebb 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1685,7 +1685,7 @@ void audio_create_pdos(Audiodev *dev)
         }                                                           \
         if (!dev->u.driver.has_out) {                               \
             dev->u.driver.out = g_malloc0(                          \
-                sizeof(AudiodevAlsaPerDirectionOptions));           \
+                sizeof(Audiodev##pdo_name##PerDirectionOptions));   \
             dev->u.driver.has_out = true;                           \
         }                                                           \
         break
-- 
2.22.0



  reply	other threads:[~2019-08-26 20:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 19:59 [Qemu-devel] [PATCH v2 0/4] Audio: misc fixes for "Audio 20190821 patches" Kővágó, Zoltán
2019-08-26 19:59 ` Kővágó, Zoltán [this message]
2019-08-26 19:59 ` [Qemu-devel] [PATCH v2 2/4] audio: omitting audiodev= parameter is only deprecated Kővágó, Zoltán
2019-08-28 11:53   ` Gerd Hoffmann
2019-08-26 19:59 ` [Qemu-devel] [PATCH v2 3/4] audio: paaudio: fix client name Kővágó, Zoltán
2019-08-27  5:37   ` Gerd Hoffmann
2019-08-27 11:26     ` Maxim Levitsky
2019-08-26 19:59 ` [Qemu-devel] [PATCH v2 4/4] audio: paaudio: ability to specify stream name Kővágó, Zoltán
2019-08-27  5:42   ` Gerd Hoffmann
2019-08-27 22:43     ` Zoltán Kővágó
2019-08-28  7:33       ` Gerd Hoffmann
2019-08-28  9:12         ` Maxim Levitsky
2019-08-28  9:53       ` Daniel P. Berrangé
2019-08-28 10:14         ` Maxim Levitsky
2019-08-28 10:26           ` Daniel P. Berrangé
2019-08-28 10:39             ` Maxim Levitsky
2019-09-09 23:42               ` Zoltán Kővágó
2019-09-10  7:00                 ` Gerd Hoffmann
2019-08-26 21:43 ` [Qemu-devel] [PATCH v2 0/4] Audio: misc fixes for "Audio 20190821 patches" Maxim Levitsky

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=7808bc816ba7da8b8de8a214713444d85f7af3c6.1566847960.git.DirtY.iCE.hu@gmail.com \
    --to=dirty.ice.hu@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=mlevitsk@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 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).