From a7ec4bb93e5a71c0d446ef2170be75315e911d56 Mon Sep 17 00:00:00 2001 From: Jakub Skowron Date: Wed, 13 Jul 2016 10:58:17 +0200 Subject: [PATCH] [NFC] Prevent crash when nfc_ndef_record_get_uri fails to set out parameter Currently nfc_ndef_record_get_uri sometimes returns NFC_ERROR_NONE while not setting uri parameter correctly. [Verification] Code compiles without errors. Change-Id: I9e420f8317c561849bd241f36d767c9c17df85ad Signed-off-by: Jakub Skowron --- src/nfc/nfc_message_utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nfc/nfc_message_utils.cc b/src/nfc/nfc_message_utils.cc index 5494b22..c5fc48a 100644 --- a/src/nfc/nfc_message_utils.cc +++ b/src/nfc/nfc_message_utils.cc @@ -767,7 +767,7 @@ static PlatformResult getURIFromHandle(nfc_ndef_record_h handle, LoggerD("Entered"); char* uri = NULL; int result = nfc_ndef_record_get_uri(handle, &uri); - if (NFC_ERROR_NONE != result) { + if (NFC_ERROR_NONE != result || !uri) { LoggerE("Can't get record's uri: %d, %s", result, NFCUtil::getNFCErrorMessage(result).c_str()); NFCMessageUtils::RemoveMessageHandle(message_handle); -- 2.7.4