ccid: Fix buffer overrun in handling of VSC_ATR message
PATCH 1/1 ccid: Fix buffer overrun in handling of VSC_ATR message
ATR size exceeding the limit is diagnosed, but then we merrily use it anyway, overrunning card->atr[].
The message is read from a character device. Obvious security implications unless the other end of the character device is trusted.
Spotted by Coverity. CVE-2011-4111.
--- hw/ccid-card-passthru.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
hw/ccid-card-passthru.c +1 -0
@@ -150,6 +150,7 @@ static void ccid_card_vscard_handle_message(PassthruState *card,error_report ("ATR size exceeds spec, ignoring" );ccid_card_vscard_send_error (card, scr_msg_header->reader_id,VSC_GENERAL_ERROR ); +break ; }memcpy (card->atr, data, scr_msg_header->length); card->atr_length = scr_msg_header->length;
Signature · 1 line
1.7.6.4
Quoted 8 lines · Markus Armbruster
ATR size exceeding the limit is diagnosed, but then we merrily use it anyway, overrunning card->atr[].
The message is read from a character device. Obvious security implications unless the other end of the character device is trusted.
Spotted by Coverity. CVE-2011-4111.
Anthony, do you want me to do a pull request for this or can you merge it as is?
Alon
Quoted 20 lines
Signed-off-by Markus Armbruster <[email protected]>--- hw/ccid-card-passthru.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)hw/ccid-card-passthru.c +1
-0@@ -150,6 +150,7 @@ static void ccid_card_vscard_handle_message(PassthruState *card,error_report ("ATR size exceeds spec, ignoring" );ccid_card_vscard_send_error (card, scr_msg_header->reader_id,VSC_GENERAL_ERROR ); +break ; }memcpy (card->atr, data, scr_msg_header->length); card->atr_length = scr_msg_header->length;Signature · 1 line
1.7.6.4
Quoted 4 lines · Alon Levy
Quoted 3 lines · Markus Armbruster
ATR size exceeding the limit is diagnosed, but then we merrily use it anyway, overrunning card->atr[].
Quoted 8 lines
Quoted 5 lines
The message is read from a character device. Obvious security implications unless the other end of the character device is trusted.
Spotted by Coverity. CVE-2011-4111.
Anthony, do you want me to do a pull request for this or can you merge it as is?
It's already in, commit 7e62255a.