mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-04-11 09:06:17 +00:00
Initialize array to keep Coverity happy
as Coverity fails seeing that szTargetTypes will always be = 0 in the case believed to lead to reading unitialized data in apttTargetTypes. CID 1090347 (#1 of 1): Uninitialized scalar variable (UNINIT) 4. uninit_use_in_call: Using uninitialized element of array "apttTargetTypes" when calling "pn53x_InAutoPoll(struct nfc_device *, pn53x_target_type const *, size_t const, uint8_t const, uint8_t const, nfc_target *, int const)".
This commit is contained in:
@@ -1184,6 +1184,7 @@ pn53x_initiator_poll_target(struct nfc_device *pnd,
|
|||||||
if (CHIP_DATA(pnd)->type == PN532) {
|
if (CHIP_DATA(pnd)->type == PN532) {
|
||||||
size_t szTargetTypes = 0;
|
size_t szTargetTypes = 0;
|
||||||
pn53x_target_type apttTargetTypes[32];
|
pn53x_target_type apttTargetTypes[32];
|
||||||
|
memset(apttTargetTypes, PTT_UNDEFINED, 32);
|
||||||
for (size_t n = 0; n < szModulations; n++) {
|
for (size_t n = 0; n < szModulations; n++) {
|
||||||
const pn53x_target_type ptt = pn53x_nm_to_ptt(pnmModulations[n]);
|
const pn53x_target_type ptt = pn53x_nm_to_ptt(pnmModulations[n]);
|
||||||
if (PTT_UNDEFINED == ptt) {
|
if (PTT_UNDEFINED == ptt) {
|
||||||
|
|||||||
Reference in New Issue
Block a user