cryptographix / pcsc-deno

Deno FFI binding to the PCSC API
MIT License
1 stars 3 forks source link

NUL character at the end of reader name #10

Open LudovicRousseau opened 1 year ago

LudovicRousseau commented 1 year ago

I note that a NUL-character is added at the end of the reader names.

For example with the sample code select-mf.ts I get:

$ deno run --unstable --allow-ffi  select-mf.ts 
Reader Gemalto PC Twin Reader 00 00: MF successfully selected
85 10 00 00 3F 00 38 00 00 00 01 00 01 00 00 00 00 6D

The extra character is not visible on the screen but it is visible if you redirect the output in a file or in xxd(1):

00000000: 5265 6164 6572 2047 656d 616c 746f 2050  Reader Gemalto P
00000010: 4320 5477 696e 2052 6561 6465 7220 3030  C Twin Reader 00
00000020: 2030 3000 3a20 4d46 2073 7563 6365 7373   00.: MF success
            here ^^
00000030: 6675 6c6c 7920 7365 6c65 6374 6564 0a38  fully selected.8
00000040: 3520 3130 2030 3020 3030 2033 4620 3030  5 10 00 00 3F 00
00000050: 2033 3820 3030 2030 3020 3030 2030 3120   38 00 00 00 01 
00000060: 3030 2030 3120 3030 2030 3020 3030 2030  00 01 00 00 00 0
00000070: 3020 3644 0a                             0 6D.

You can see a 0x00 between " 00" (2030 30) and ":" (3a) on the 3rd line of the dump.