qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy White <jwhite@codeweavers.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Retrieve the correct TD byte when checking an ATR.
Date: Mon, 19 Jan 2015 08:57:31 -0600	[thread overview]
Message-ID: <1421679451-9096-1-git-send-email-jwhite@codeweavers.com> (raw)

A physical smartcard with an ATR of
  3B 95 95 40 FF AE 01 0E 00 00
was parsed incorrectly.

The '40' should have been the second TD; instead
the FF is used, incorrectly.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
---
 hw/usb/ccid-card-passthru.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 10f1d30..2ae3b81 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -168,8 +168,8 @@ static int check_atr(PassthruState *card, uint8_t *data, int len)
             opt_bytes++;
         }
         if (td & 0x8) {
-            opt_bytes++;
             td = data[opt_bytes + 2] >> 4;
+            opt_bytes++;
         }
     }
     if (len < 2 + historical_length + opt_bytes) {
-- 
1.7.10.4

             reply	other threads:[~2015-01-19 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 14:57 Jeremy White [this message]
2015-01-19 16:11 ` [Qemu-devel] [PATCH] Retrieve the correct TD byte when checking an ATR Marc-André Lureau
2015-01-19 16:24   ` Jeremy White

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=1421679451-9096-1-git-send-email-jwhite@codeweavers.com \
    --to=jwhite@codeweavers.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).