Commit Graph
12 Commits
Author SHA1 Message Date
pingu2211 514fe677d6 rename all mifarehost functions to match style guide 2024-11-14 09:33:57 +11:00
iceman1001 34e00146c6 change data available check in hf mf sim on device side. 2024-09-14 18:37:56 +02:00
Philippe Teuwen 0a22929eac Fix buffer overflow
Strangely only detected by Ubuntu 18.4 gcc 7.5.0

```
[-] CC src/cmdhflist.c
In file included from /usr/include/string.h:494:0,
                 from src/cmdhfict.c:21:
In function 'memcpy',
    inlined from 'diversify_mifare_key' at src/cmdhfict.c:151:5,
    inlined from 'derive_mifare_key' at src/cmdhfict.c:189:5,
    inlined from 'CmdHfIctReader' at src/cmdhfict.c:199:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin___memcpy_chk' writing 8 bytes into a region of size 6 overflows the destination [-Werror=stringop-overflow=]
   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'memcpy',
    inlined from 'diversify_mifare_key' at src/cmdhfict.c:151:5,
    inlined from 'derive_mifare_key' at src/cmdhfict.c:189:5,
    inlined from 'CmdHfIctReader' at src/cmdhfict.c:203:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:34:10: error: '__builtin___memcpy_chk' writing 8 bytes into a region of size 6 overflows the destination [-Werror=stringop-overflow=]
   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

```c
    uint8_t diverse[MIFARE_KEY_SIZE]; // = 6
    diversify_mifare_key(uid, diverse);
```

```c
static int diversify_mifare_key(const uint8_t *uid, uint8_t *app_key) {
...
    uint8_t output[8];
...
    memcpy(app_key, output, sizeof(output));
```
2024-09-10 09:02:46 +02:00
iceman1001 bf24c2b01f const params and init arrays 2024-05-14 11:23:33 +02:00
iceman1001 a6af4df5ed forgot command line parsing 2024-02-18 09:06:00 +01:00
iceman1001 f5e976afa6 style 2024-02-16 21:59:45 +01:00
iceman1001 dac0a392bd fix wrong arg num 2024-02-13 17:32:33 +01:00
iceman1001 8f896940b0 detect desfire rudimentary 2024-02-03 16:58:03 +01:00
iceman1001 7c6d60e7ef style 2024-02-03 16:05:58 +01:00
iceman1001 c3b8d6d942 added a skeleton command for reading credential 2024-02-03 15:10:37 +01:00
iceman1001 6d82079c0b next steps 2024-02-03 11:15:10 +01:00
iceman1001 2d4597d89b added skeleton command for ICT 2024-02-01 10:05:04 +01:00