cppcheck: add test to avoid dereferncing null pointer
This commit is contained in:
1 parent
17d7fb8abb
commit
eb23028514
2 files changed
+4
-1
No files matched your search
@@ -440,7 +440,8 @@ int APDUDecode(uint8_t *data, int len, APDU_t *apdu) {
|
||||
int APDUEncode(APDU_t *apdu, uint8_t *data, int *len) {
|
||||
if (len)
|
||||
*len = 0;
|
||||
|
||||
if (apdu == NULL)
|
||||
return 1;
|
||||
if (apdu->le > 0x10000)
|
||||
return 1;
|
||||
|
||||
|
||||
@@ -141,6 +141,8 @@ int fnf(uint64_t s) {
|
||||
|
||||
// builds the lfsr for the prng (quick calcs for hitag2_nstep())
|
||||
void buildlfsr(Hitag_State *hstate) {
|
||||
if (hstate == NULL)
|
||||
return;
|
||||
uint64_t state = hstate->shiftreg;
|
||||
uint64_t temp = state ^ (state >> 1);
|
||||
hstate->lfsr = state ^ (state >> 6) ^ (state >> 16)
|
||||
|
||||
Reference in new issue
Block a user