summaryrefslogtreecommitdiff
path: root/scard-opensc.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-06-28 18:08:16 +1000
committerDamien Miller <djm@mindrot.org>2003-06-28 18:08:16 +1000
commit723569b257c8b1f48836ea777886c10bfa844692 (patch)
treee8a8a0b8b2d6edd0db64c0837346c63a1b447ed8 /scard-opensc.c
parent4a8e2848556682541799118528fe3b56b901c5f7 (diff)
downloadopenssh-git-723569b257c8b1f48836ea777886c10bfa844692.tar.gz
- (djm) Bug #593: Sanity check OpenSC card reader number; patch from
aj@dungeon.inka.de
Diffstat (limited to 'scard-opensc.c')
-rw-r--r--scard-opensc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/scard-opensc.c b/scard-opensc.c
index e8e12dd8..4ab87ea8 100644
--- a/scard-opensc.c
+++ b/scard-opensc.c
@@ -89,6 +89,12 @@ sc_init(void)
r = sc_establish_context(&ctx, "openssh");
if (r)
goto err;
+ if (sc_reader_id >= ctx->reader_count) {
+ r = SC_ERROR_NO_READERS_FOUND;
+ error("Illegal reader number %d (max %d)", sc_reader_id,
+ ctx->reader_count -1);
+ goto err;
+ }
r = sc_connect_card(ctx->reader[sc_reader_id], 0, &card);
if (r)
goto err;