nfctype5: Discard extra byte in RMB response data

Sometimes there can be an extra byte in the response data for Read
Multiple Blocks (RMB) commands so discard it whenever that happens.

Signed-off-by: Mark Greer <mgreer@animalcreek.com>
diff --git a/plugins/nfctype5.c b/plugins/nfctype5.c
index a91d8f5..d6eec3c 100644
--- a/plugins/nfctype5.c
+++ b/plugins/nfctype5.c
@@ -654,7 +654,7 @@
 	uint8_t blk_size = near_tag_get_blk_size(tag);
 	size_t data_length;
 	GList *records;
-	int err;
+	int err, expected_len;
 
 	DBG("");
 
@@ -665,9 +665,16 @@
 		goto out_done;
 
 	length -= NFC_HEADER_SIZE;
+	expected_len = sizeof(*t5_resp) +
+		       cookie->nb_requested_blocks * blk_size;
 
-	if (length != (int)(sizeof(*t5_resp) +
-			    (cookie->nb_requested_blocks * blk_size))) {
+	/*
+	 * Sometimes an extra byte is returned in RMB response data.
+	 * Discard the extra byte whenever that happens.
+	 */
+	if (length == (expected_len + 1)) {
+		length--;
+	} else if (length != expected_len) {
 		err = -EIO;
 		goto out_done;
 	}