Commit Graph

298 Commits

Author SHA1 Message Date
akallabeth
5c0ccb7575 Fixed formatting. 2020-06-04 07:55:12 +02:00
Ondrej Holy
c03f68059d smartcard: Teoretical fix of uninitialized values
This tries to fixes the following defects reported by covscan tool:
 - channels/smartcard/client/smartcard_operations.c:958: uninit_use_in_call: Using uninitialized value "ret.cReaders" when calling "smartcard_pack_locate_cards_return".
 - channels/smartcard/client/smartcard_operations.c:932: uninit_use_in_call: Using uninitialized value "ret.cReaders" when calling "smartcard_pack_locate_cards_return".

But I am not sure about it...
2020-06-04 07:55:12 +02:00
Ondrej Holy
7554154a04 smartcard: Fix usage of uninitialized values
This fixes the following defect reported by covscan tool:
 - channels/smartcard/client/smartcard_pack.c:942: uninit_use_in_call: Using uninitialized value "tmp" when calling "ConvertFromUnicode".
 - channels/smartcard/client/smartcard_pack.c:894: uninit_use_in_call: Using uninitialized value "tmp" when calling "ConvertFromUnicode".
 - channels/smartcard/client/smartcard_pack.c:475: uninit_use_in_call: Using uninitialized value "tmp" when calling "ConvertFromUnicode".
2020-06-04 07:55:12 +02:00
akallabeth
feb7d4f362 Changed smartcard no reader log message level to info 2020-05-08 11:21:51 +02:00
akallabeth
af79aafbba Fixed int overflow in smartcard_ndr_read
Thanks to hac425
2020-05-08 11:04:03 +02:00
Armin Novak
e80316cf9a Silence SCARD_E_TIMEOUT warnings
These occur quite often for status calls, so reduce log verbosity.
2020-05-04 17:32:55 +02:00
Alex Wilson
40f23e2728 SCardReadCache/SCardWriteCache should actually cache data
Currently since the hash/keyCompare/keyClone members on the
context->cache were never being set, we were using the
HashTable_Pointer* variants, meaning that lookup always
failed (since we never ask for the same *pointer* twice).

This also revealed that the logic for autoallocate on these ops
was a bit backwards, and some error codes and support for the
"freshness" counter were missing.

In Win10 (at least with some card minidrivers) the freshness
counter is load-bearing and smartcard login won't work without
implementing a very basic version of it.
2020-04-21 08:11:54 +02:00
akallabeth
6b66aa71fb Fixi #6086: smartcard filter early abort.
Do not abort before incrementing read position.
2020-04-14 19:04:11 +02:00
Alex Wilson
c6e675bfb7 Always copy null terminator when filtering smartcard list 2020-04-09 10:44:25 +02:00
akallabeth
2749de506c Added missing context and handle read. 2020-03-30 11:07:47 +02:00
Armin Novak
f360d445e2 Pack smartcard channel structs to 1 byte alignment 2020-03-27 18:24:25 +01:00
akallabeth
ac4ec690c9 Removed a few magic numbers. 2020-03-27 15:03:59 +01:00
akallabeth
80177efe69 Fixed typos, make status comparisons explicit. 2020-03-27 14:49:09 +01:00
Armin Novak
2968e41409 Fixed missing boundary checks in smartcard_array_dump 2020-03-02 09:01:39 +01:00
Armin Novak
bef8dda5e1 Fixed data length for list reader group return. 2020-02-20 15:35:11 +01:00
Armin Novak
5ab0716d7b SCardListReadersW return length is in bytes, not char. 2020-02-20 15:24:03 +01:00
Armin Novak
fd89ff6913 Fixed some conversion warnings. 2020-02-20 14:40:19 +01:00
Armin Novak
9b5f1ab384 Beautify smartcard log. 2020-02-20 13:59:28 +01:00
Armin Novak
893d08d653 Decreased smartcard log verbosity. 2020-02-20 13:59:28 +01:00
Armin Novak
a8e8351c1d Removed duplicated copyright claim 2020-02-20 13:59:28 +01:00
Armin Novak
f885476423 Fixed 8bit and 16bit return string sizes. 2020-02-20 13:59:28 +01:00
Armin Novak
ef93109f42 Fixes for GetAttrib and some refactroing
* Fix accidental buffer free before transfer
* Refactored code to eliminate a bunch of warnings
* Updated copyright headers
2020-02-20 13:59:28 +01:00
Armin Novak
fe61eab88c Fixed SCardReadCache autoallocate handling. 2020-02-20 13:59:28 +01:00
Armin Novak
04f0e679f7 Fixed NDR pointer handling for smartcard data. 2020-02-20 13:59:28 +01:00
Armin Novak
11d3ea3b43 Fix #5847: Missing length check to trace smartcard buffers. 2020-02-10 14:28:38 +01:00
Armin Novak
11f2532242 Added unified NDR pointer reading. 2020-01-24 13:52:43 +01:00
Armin Novak
7b50ed887e Fixed missing length checks for smartcard IRP read. 2020-01-24 13:23:40 +01:00
Armin Novak
f4ee8d92a7 Fixed smartcard type mismatches. 2020-01-23 10:39:43 +01:00
Armin Novak
f0db6f2ead Unified smartcart multistring conversion. 2020-01-23 10:07:54 +01:00
Armin Novak
ee7950c95c Fixed type mismatches on allocation. 2020-01-23 09:48:20 +01:00
Armin Novak
ec5881e3f2 Fixed smartcard_SetAttrib_Decode call type 2020-01-23 09:32:34 +01:00
Armin Novak
dfe7b8c8da Implement missing functions for new smartcard
Newer smartcard channel behaviour expects a lot more callbacks
being implemented. This change provides them.
2020-01-13 11:27:37 +01:00
Armin Novak
7c243da6e1 Remove symbols exported by accident. 2019-12-02 10:57:31 +01:00
Armin Novak
72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
Armin Novak
59b4988f56 Fixed compilation warnings. 2019-10-16 14:54:05 +02:00
Bernhard Miklautz
a311075202 fix [channels/smartcard]: fix StatusW_Call
According to 2.2.2.18 Status_Call cbAtrLen is unused an must be ignored
upon receipt.
2019-07-30 09:48:47 +02:00
Armin Novak
60a82854c1 For smartcard trace functions use const arguments 2019-05-08 15:13:03 +02:00
Armin Novak
4b72a85e91 Fixed possible memory leak. 2019-05-08 15:12:40 +02:00
Armin Novak
8f7e1579fd Silenced unused parameter warnings in smartcard trace 2019-05-08 12:27:51 +02:00
r-barnett
40ef08ddc5 Fix smartcard segfault when no devices are present (#5364)
* Don't assume smartcard reader list is not empty.

* Check status of retrieval of smartcard device list before trying to filter it

* style fixes
2019-05-02 06:11:57 +02:00
Pascal J. Bourguignon
431c37f3a9 5360 segfault using smartcard without any readers (#5361)
* Fix: corrected test for astyle.

* Fix: added test for NULL readers returned by ConvertFromUnicode.
2019-04-26 09:10:41 +02:00
Armin Novak
b9b3f3eda7 Fixed sign-compare warnings 2019-04-05 09:13:24 +02:00
Armin Novak
ef1728faf5 Fixed NULL dereferences and uninitialized values 2019-01-30 16:11:10 +01:00
Armin Novak
a8a6accc15 Fixed compiler warnings. 2018-10-03 15:16:59 +02:00
Armin Novak
f63286dbea Fixed smartcard filter for empty arguments. 2018-09-19 11:13:02 +02:00
Armin Novak
4596588e0f Set freed pointer to NULL avoiding double free. 2018-09-04 15:22:06 +02:00
Armin Novak
b2ce309b28 Added multi filter for smartcard. (based on #4837 by @informatimago) 2018-09-04 14:34:32 +02:00
Ondrej Holy
97f25e8ab4 channels/smartcard: Fix leak found by covscan
leaked_storage: Variable "operation" going out of scope leaks the storage it points to.
2018-08-22 13:35:43 +02:00
Ondrej Holy
3baa716706 channels/smartcard: Format code by astyle
Run ./scripts/format_code.sh before the following changes.
2018-08-22 13:35:43 +02:00
Ruben De Visscher
1835a39aaf Fix inconsistent cBytes value between WinScard and pcsc-lite. 2018-04-24 10:33:44 +02:00