Check malloc(3) return value.
This commit is contained in:
parent
65894ca3b4
commit
f6c7f7692b
1 changed files with 2 additions and 1 deletions
|
@ -474,7 +474,8 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c
|
||||||
}
|
}
|
||||||
|
|
||||||
edl = enciphered_data_length (tag, *nbytes - 1, communication_settings);
|
edl = enciphered_data_length (tag, *nbytes - 1, communication_settings);
|
||||||
edata = malloc (edl);
|
if (!(edata = malloc (edl)))
|
||||||
|
abort ();
|
||||||
|
|
||||||
memcpy (edata, data, *nbytes - 1);
|
memcpy (edata, data, *nbytes - 1);
|
||||||
memset ((uint8_t *)edata + *nbytes - 1, 0, edl - *nbytes + 1);
|
memset ((uint8_t *)edata + *nbytes - 1, 0, edl - *nbytes + 1);
|
||||||
|
|
Loading…
Reference in a new issue