nfctype2: Do not read data if CC indicates a zero length
authorSamuel Ortiz <sameo@linux.intel.com>
Thu, 12 May 2011 15:17:50 +0000 (17:17 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 21 Oct 2011 06:54:03 +0000 (23:54 -0700)
plugins/nfctype2.c

index d989a7a..4f3d476 100644 (file)
@@ -164,6 +164,8 @@ static int meta_recv(uint8_t *resp, int length, void *data)
 
        tag->data_length = TAG_DATA_LENGTH(tag->cc);
        tag->data = g_try_malloc0(tag->data_length);
+       if (tag->data == NULL || tag->data_length = 0)
+               return -ENOMEM;
 
        return data_read(tag);
 }