RETV_IF(NULL == length, NET_NFC_NULL_PARAMETER);
*length = net_nfc_util_get_ndef_message_length(ndef_message);
- if (*length > 0)
+ if (*length >= 0)
result = NET_NFC_OK;
else
result = NET_NFC_INVALID_PARAM;
if (neardal_get_tag_properties(tagName, &tag) != NEARDAL_SUCCESS)
return;
- if (tag == NULL || tag->records == NULL)
+ if (tag == NULL)
return;
net_nfc_manager_util_play_sound(NET_NFC_TASK_START);
rawNDEF->length = (int)length;
rawNDEF->buffer = g_try_malloc0(rawNDEF->length);
- if (rawNDEF->buffer == NULL) {
+ if (rawNDEF->length > 0 && rawNDEF->buffer == NULL) {
g_free(rawNDEF);
goto exit;
}
if (record == NULL)
return NET_NFC_ALLOC_FAIL;
- record->name = g_strdup(tag->records[0]);
+ if (tag->records != NULL)
+ record->name = g_strdup(tag->records[0]);
+ else
+ record->name = g_strdup(tag->name);
record->type = g_strdup("Raw");
record->rawNDEF = g_try_malloc0(data->length);
if (record->rawNDEF == NULL) {
RETV_IF(NULL == ndef, NET_NFC_NULL_PARAMETER);
RETV_IF(NULL == rawdata, NET_NFC_NULL_PARAMETER);
- RETV_IF(rawdata->length < 3, NET_NFC_INVALID_FORMAT);
+ RETV_IF(rawdata->length < 0, NET_NFC_INVALID_FORMAT);
current = rawdata->buffer;
last = current + rawdata->length;
ndef->recordCount++;
- if((current != last) || ((ndef_header & NET_NFC_NDEF_RECORD_MASK_ME) == 0))
+ if((current != last) || (((ndef_header & NET_NFC_NDEF_RECORD_MASK_ME) == 0) && (rawdata->length != 0)))
{
result = NET_NFC_INVALID_FORMAT;
goto error;