aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-01-27 13:31:13 +0000
committerWerner Koch <[email protected]>2016-01-27 13:31:13 +0000
commit3d952a2fe5da9d84c20d3debdcc1e425b08781c6 (patch)
treeac5937a1a47d7771aadc816eb4309558b2c16b1a
parentscd: Fix detection of libusb. (diff)
downloadgnupg-3d952a2fe5da9d84c20d3debdcc1e425b08781c6.tar.gz
gnupg-3d952a2fe5da9d84c20d3debdcc1e425b08781c6.zip
scd: Fix size_t/int mismatch in libusb
* scd/ccid-driver.c (bulk_in, abort_cmd, ccid_poll): Change msglen to int. -- Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--scd/ccid-driver.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index 4d83b1fee..87cec3296 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -1952,7 +1952,7 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
int no_debug)
{
int rc;
- size_t msglen;
+ int msglen;
int eagain_retries = 0;
/* Fixme: The next line for the current Valgrind without support
@@ -1973,6 +1973,8 @@ bulk_in (ccid_driver_t handle, unsigned char *buffer, size_t length,
}
return CCID_DRIVER_ERR_CARD_IO_ERROR;
}
+ if (msglen < 0)
+ return CCID_DRIVER_ERR_INV_VALUE; /* Faulty libusb. */
*nread = msglen;
}
else
@@ -2081,7 +2083,7 @@ abort_cmd (ccid_driver_t handle, int seqno)
int rc;
char dummybuf[8];
unsigned char msg[100];
- size_t msglen;
+ int msglen;
if (!handle->idev)
{
@@ -2252,7 +2254,7 @@ ccid_poll (ccid_driver_t handle)
{
int rc;
unsigned char msg[10];
- size_t msglen;
+ int msglen;
int i, j;
if (handle->idev)