From: Youngjae Shin Date: Sat, 31 Aug 2013 01:48:49 +0000 (+0900) Subject: fix wrong pointer handling X-Git-Tag: accepted/tizen/generic/20140408.093248~7^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c614c712cd0e49e6d631281bdc8c85f87cd5aa24;p=platform%2Fcore%2Fconnectivity%2Fnfc-manager.git fix wrong pointer handling --- diff --git a/packaging/nfc-manager.spec b/packaging/nfc-manager.spec index 4b37490..b2b9a86 100644 --- a/packaging/nfc-manager.spec +++ b/packaging/nfc-manager.spec @@ -1,6 +1,6 @@ Name: nfc-manager Summary: NFC framework manager -Version: 0.0.48 +Version: 0.0.49 Release: 0 Group: libs License: Flora Software License diff --git a/src/clientlib/net_nfc_client_ndef_record.c b/src/clientlib/net_nfc_client_ndef_record.c index aff8fbf..df6cd88 100644 --- a/src/clientlib/net_nfc_client_ndef_record.c +++ b/src/clientlib/net_nfc_client_ndef_record.c @@ -164,9 +164,7 @@ NET_NFC_EXPORT_API uint8_t net_nfc_get_record_sr(uint8_t flag) NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_text_string_from_text_record(ndef_record_h record, char** buffer) { if (record == NULL || buffer == NULL) - { return NET_NFC_ALLOC_FAIL; - } data_h payload; data_h rec_type; @@ -182,9 +180,13 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_text_string_from_text_record(n if (net_nfc_get_record_payload(record, &payload) == NET_NFC_OK) { - uint8_t* buffer_temp = net_nfc_get_data_buffer(payload); + uint8_t *buffer_temp; uint32_t buffer_length = net_nfc_get_data_length(payload); + buffer_temp = net_nfc_get_data_buffer(payload); + if (NULL == buffer_temp) + return NET_NFC_NO_DATA_FOUND; + int controllbyte = buffer_temp[0]; int lang_code_length = controllbyte & 0x3F; int index = lang_code_length + 1; @@ -225,8 +227,12 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_languange_code_string_from_text_r if (net_nfc_get_record_payload(record, &payload) == NET_NFC_OK) { - uint8_t* buffer_temp = net_nfc_get_data_buffer(payload); - char * buffer = NULL; + char *buffer = NULL; + uint8_t *buffer_temp; + + buffer_temp = net_nfc_get_data_buffer(payload); + if (NULL == buffer_temp) + return NET_NFC_NO_DATA_FOUND; int controllbyte = buffer_temp[0]; int lang_code_length = controllbyte & 0x3F; @@ -269,7 +275,11 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_encoding_type_from_text_record(nd if (net_nfc_get_record_payload(record, &payload) == NET_NFC_OK) { - uint8_t* buffer_temp = net_nfc_get_data_buffer(payload); + uint8_t *buffer_temp; + + buffer_temp = net_nfc_get_data_buffer(payload); + if (NULL == buffer_temp) + return NET_NFC_NO_DATA_FOUND; int controllbyte = buffer_temp[0]; diff --git a/src/manager/net_nfc_app_util.c b/src/manager/net_nfc_app_util.c index bb2abbd..e277e4d 100644 --- a/src/manager/net_nfc_app_util.c +++ b/src/manager/net_nfc_app_util.c @@ -84,7 +84,6 @@ net_nfc_error_e net_nfc_app_util_process_ndef(data_s *data) char uri[2048] = { 0, }; #endif int ret = 0; - int disable = 0; if (data == NULL || data->buffer == NULL || data->length == 0) {