From: P J P <ppandit@redhat.com>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>,
Arash TC <tohidi.arash@gmail.com>,
Prasad J Pandit <pjp@fedoraproject.org>
Subject: [Qemu-devel] [PATCH] ccid-card-passthru: check buffer size parameter
Date: Thu, 11 Oct 2018 16:54:36 +0530 [thread overview]
Message-ID: <20181011112436.9305-1-ppandit@redhat.com> (raw)
From: Prasad J Pandit <pjp@fedoraproject.org>
While reading virtual smart card data, if buffer 'size' is negative
it would lead to memory corruption errors. Add check to avoid it.
Reported-by: Arash TC <tohidi.arash@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
hw/usb/ccid-card-passthru.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 0a6c657228..63ed78f4c6 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -275,6 +275,7 @@ static void ccid_card_vscard_read(void *opaque, const uint8_t *buf, int size)
PassthruState *card = opaque;
VSCMsgHeader *hdr;
+ assert(0 <= size && size < VSCARD_IN_SIZE);
if (card->vscard_in_pos + size > VSCARD_IN_SIZE) {
error_report("no room for data: pos %u + size %d > %" PRId64 "."
" dropping connection.",
--
2.17.1
next reply other threads:[~2018-10-11 11:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 11:24 P J P [this message]
2018-10-11 11:58 ` [Qemu-devel] [PATCH] ccid-card-passthru: check buffer size parameter Philippe Mathieu-Daudé
2018-10-11 12:15 ` Paolo Bonzini
2018-10-11 12:29 ` P J P
2018-10-11 12:34 ` Paolo Bonzini
2018-10-11 12:38 ` Philippe Mathieu-Daudé
2018-10-11 12:50 ` P J P
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=20181011112436.9305-1-ppandit@redhat.com \
--to=ppandit@redhat.com \
--cc=kraxel@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=qemu-devel@nongnu.org \
--cc=tohidi.arash@gmail.com \
/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).