device: Check for NFCID length being greater than zero
authorSamuel Ortiz <sameo@linux.intel.com>
Mon, 21 May 2012 16:33:21 +0000 (18:33 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Sat, 26 May 2012 14:23:05 +0000 (16:23 +0200)
src/device.c

index 34ef5a2..185da9a 100644 (file)
@@ -328,7 +328,7 @@ struct near_device *__near_device_add(uint32_t adapter_idx, uint32_t target_idx,
        device->target_idx = target_idx;
        device->n_records = 0;
 
-       if (nfcid_len <= NFC_MAX_NFCID1_LEN) {
+       if (nfcid_len <= NFC_MAX_NFCID1_LEN && nfcid_len > 0) {
                device->nfcid_len = nfcid_len;
                memcpy(device->nfcid, nfcid, nfcid_len);
        }