aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Greer <mgreer@animalcreek.com>2017-02-16 18:25:48 +0000
committerSamuel Ortiz <sameo@linux.intel.com>2017-11-10 00:16:54 +0100
commit23f864ef891a26420b1b855ac768d7d1fc99085d (patch)
tree245b221497e1930e7a35b205173424d69732fc1b
parent564e38bbaceb3ad19ff07ebddaf11b7001ef8ace (diff)
downloadneard-23f864ef891a26420b1b855ac768d7d1fc99085d.tar.gz
ndef: Discard records containing errors
Currently, near_ndef_parse_msg() adds records even when they contain erroneous record types. This can later cause neard to exit when it tries to signal dbus with incomplete record information. Avoid this by ignoring records that contain bad record types (and all of the records that follow in the same NDEF message). Signed-off-by: Mark Greer <mgreer@animalcreek.com>
-rw-r--r--src/ndef.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ndef.c b/src/ndef.c
index 6918f45..cad6227 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -2845,7 +2845,6 @@ GList *near_ndef_parse_msg(uint8_t *ndef_data, size_t ndef_length,
case RECORD_TYPE_WKT_COLLISION_RESOLUTION:
case RECORD_TYPE_WKT_ERROR:
case RECORD_TYPE_UNKNOWN:
- case RECORD_TYPE_ERROR:
break;
case RECORD_TYPE_WKT_HANDOVER_REQUEST:
@@ -2927,6 +2926,8 @@ GList *near_ndef_parse_msg(uint8_t *ndef_data, size_t ndef_length,
goto fail;
break;
+ case RECORD_TYPE_ERROR:
+ goto fail;
}
record->data_len = record->header->header_len +