diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-12 10:49:18 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-12 10:49:18 +0200 |
commit | 00f7dda05ba76ee3aff954e84f9795460e2fb917 (patch) | |
tree | f953f53eeccf527dca10ca2635bcf3489b3af7ed | |
parent | 9b142a0aa5331190658eb27edd35ff10bf58e211 (diff) | |
download | neard-00f7dda05ba76ee3aff954e84f9795460e2fb917.tar.gz neard-00f7dda05ba76ee3aff954e84f9795460e2fb917.tar.bz2 neard-00f7dda05ba76ee3aff954e84f9795460e2fb917.zip |
ndef: Do not fail if NDEF record MIME type is not a handover one
NDEFs with MIME type records that are not WSC or Bluetooth ones are not
wrong. Their payload won't be processed but the record is kept and
linked to the discovered tag.
NDEF agents will get the binary payload.
Fixes #NFC-45
-rw-r--r-- | src/ndef.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1365,13 +1365,10 @@ static struct near_ndef_mime_payload *parse_mime_type( c_temp->size = record->header->payload_len; memcpy(c_temp->data, ndef_data + offset, c_temp->size); } else { - g_free(mime->type); - g_free(mime); g_free(c_temp); - mime = NULL; c_temp = NULL; *c_data = NULL; - return NULL; + return mime; } *c_data = c_temp; @@ -2577,9 +2574,13 @@ GList *near_ndef_parse_msg(uint8_t *ndef_data, size_t ndef_length, ndef_length, offset, record->header->payload_len, &c_data); - if (record->mime == NULL || c_data == NULL) + if (record->mime == NULL) goto fail; + /* No carrier data, move on */ + if (c_data == NULL) + break; + if (process_mime_type(record->mime, c_data) < 0) { g_free(c_data); c_data = NULL; |