diff options
| -rw-r--r-- | libese-spi/p73/lib/phNxpEse_Api.cpp | 12 | ||||
| -rwxr-xr-x | libese-spi/p73/pal/spi/phNxpEsePal_spi.cpp | 10 | ||||
| -rw-r--r-- | libese-spi/p73/utils/config.cpp | 5 | ||||
| -rwxr-xr-x | libese-spi/p73/utils/config.h | 1 | ||||
| -rwxr-xr-x | libese-spi/src/adaptation/NfcAdaptation.cpp | 2 | ||||
| -rwxr-xr-x | ls_client/src/LsClient.cpp | 12 | ||||
| -rwxr-xr-x | ls_client/src/LsLib.cpp | 10 |
7 files changed, 27 insertions, 25 deletions
diff --git a/libese-spi/p73/lib/phNxpEse_Api.cpp b/libese-spi/p73/lib/phNxpEse_Api.cpp index 70070fd..4d054b8 100644 --- a/libese-spi/p73/lib/phNxpEse_Api.cpp +++ b/libese-spi/p73/lib/phNxpEse_Api.cpp @@ -210,7 +210,7 @@ ESESTATUS phNxpEse_open(phNxpEse_initParams initParams) { /*Read device node path*/ ese_node = EseConfig::getString(NAME_NXP_ESE_DEV_NODE, "/dev/pn81a"); - strcpy(ese_dev_node, ese_node.c_str()); + strlcpy(ese_dev_node, ese_node.c_str(), sizeof(ese_dev_node)); tPalConfig.pDevName = (int8_t*)ese_dev_node; /* Initialize PAL layer */ @@ -344,7 +344,7 @@ bool phNxpEse_isOpen() { return nxpese_ctxt.EseLibStatus != ESE_STATUS_CLOSE; } ESESTATUS phNxpEse_openPrioSession(phNxpEse_initParams initParams) { phPalEse_Config_t tPalConfig; ESESTATUS wConfigStatus = ESESTATUS_SUCCESS; - unsigned long int num = 0, tpm_enable = 0; + unsigned long int num = 0; ALOGE("phNxpEse_openPrioSession Enter"); #ifdef SPM_INTEGRATED @@ -481,14 +481,6 @@ ESESTATUS phNxpEse_openPrioSession(phNxpEse_initParams initParams) { } wConfigStatus = phPalEse_ioctl(phPalEse_e_EnablePollMode, nxpese_ctxt.pDevHandle, 1); - if (tpm_enable) { - wConfigStatus = phPalEse_ioctl(phPalEse_e_EnableThroughputMeasurement, - nxpese_ctxt.pDevHandle, 0); - if (wConfigStatus != ESESTATUS_SUCCESS) { - ALOGE("phPalEse_IoCtl Failed"); - goto clean_and_return; - } - } if (wConfigStatus != ESESTATUS_SUCCESS) { ALOGE("phPalEse_IoCtl Failed"); goto clean_and_return; diff --git a/libese-spi/p73/pal/spi/phNxpEsePal_spi.cpp b/libese-spi/p73/pal/spi/phNxpEsePal_spi.cpp index 21057b6..cb2d4c5 100755 --- a/libese-spi/p73/pal/spi/phNxpEsePal_spi.cpp +++ b/libese-spi/p73/pal/spi/phNxpEsePal_spi.cpp @@ -89,6 +89,11 @@ void phPalEse_spi_close(void* pDevHandle) { return; } ESESTATUS phNxpEse_spiIoctl(uint64_t ioctlType, void* p_data) { + if (!p_data) { + ALOGD_IF(ese_debug_enabled, "%s:p_data is null ioctltyp: %ld", __FUNCTION__, + (long)ioctlType); + return ESESTATUS_FAILED; + } ese_nxp_IoctlInOutData_t* inpOutData = (ese_nxp_IoctlInOutData_t*)p_data; rf_status = inpOutData->inp.data.nxpCmd.p_cmd[0]; if (rf_status == 1) { @@ -99,11 +104,6 @@ ESESTATUS phNxpEse_spiIoctl(uint64_t ioctlType, void* p_data) { ese_debug_enabled, "******************RF IS OFF*************************************"); } - if (p_data != NULL) { - ALOGD_IF(ese_debug_enabled, - "halimpl phNxpEse_spiIoctl p_data is not null ioctltyp: %ld", - (long)ioctlType); - } return ESESTATUS_SUCCESS; } diff --git a/libese-spi/p73/utils/config.cpp b/libese-spi/p73/utils/config.cpp index c304226..5983d59 100644 --- a/libese-spi/p73/utils/config.cpp +++ b/libese-spi/p73/utils/config.cpp @@ -41,6 +41,11 @@ bool parseBytesString(std::string in, std::vector<uint8_t>& out) { } // namespace +ConfigValue::ConfigValue() { + value_unsigned_ = 0; + type_ = UNSIGNED; +} + ConfigValue::Type ConfigValue::getType() const { return type_; } std::string ConfigValue::getString() const { diff --git a/libese-spi/p73/utils/config.h b/libese-spi/p73/utils/config.h index 90bbcc1..6a5ccb1 100755 --- a/libese-spi/p73/utils/config.h +++ b/libese-spi/p73/utils/config.h @@ -23,6 +23,7 @@ class ConfigValue { public: enum Type { UNSIGNED, STRING, BYTES }; + ConfigValue(); Type getType() const; std::string getString() const; unsigned getUnsigned() const; diff --git a/libese-spi/src/adaptation/NfcAdaptation.cpp b/libese-spi/src/adaptation/NfcAdaptation.cpp index 76ca268..55745f5 100755 --- a/libese-spi/src/adaptation/NfcAdaptation.cpp +++ b/libese-spi/src/adaptation/NfcAdaptation.cpp @@ -144,7 +144,7 @@ void ThreadMutex::unlock() { pthread_mutex_unlock(&mMutex); } ** Returns: none ** *******************************************************************************/ -NfcAdaptation::NfcAdaptation() {} +NfcAdaptation::NfcAdaptation() { mCurrentIoctlData = NULL; } /******************************************************************************* ** diff --git a/ls_client/src/LsClient.cpp b/ls_client/src/LsClient.cpp index f7a78de..4c874a9 100755 --- a/ls_client/src/LsClient.cpp +++ b/ls_client/src/LsClient.cpp @@ -130,6 +130,7 @@ void getLSScriptSourcePrefix(std::string& prefix) { if (c == ' ' || c == '\n' || c == '\r' || c == 0x00) break; prefix.push_back(c); } + fclose(fd); } else { ALOGD("%s Cannot open file %s\n", __func__, source_path); } @@ -332,13 +333,20 @@ void* performLSDownload_thread(__attribute__((unused)) void* data) { /*Read the script content to a local buffer*/ fseek(fIn, 0, SEEK_END); long lsBufSize = ftell(fIn); + if (lsBufSize < 0) { + ALOGE("%s Failed to get current value of position indicator\n", __func__); + fclose(fIn); + status = LSCSTATUS_FAILED; + break; + } rewind(fIn); if (lsHashInfo.lsRawScriptBuf == nullptr) { lsHashInfo.lsRawScriptBuf = (uint8_t*)phNxpEse_memalloc(lsBufSize + 1); } memset(lsHashInfo.lsRawScriptBuf, 0x00, (lsBufSize + 1)); - fread(lsHashInfo.lsRawScriptBuf, lsBufSize, 1, fIn); - + if (fread(lsHashInfo.lsRawScriptBuf, (size_t)lsBufSize, 1, fIn) != 1) + ALOGD_IF(ese_debug_enabled, "%s Failed to read file", __func__); + fclose(fIn); LSCSTATUS lsHashStatus = LSCSTATUS_FAILED; /*Get 20bye SHA1 of the script*/ diff --git a/ls_client/src/LsLib.cpp b/ls_client/src/LsLib.cpp index 82f64f0..c670408 100755 --- a/ls_client/src/LsLib.cpp +++ b/ls_client/src/LsLib.cpp @@ -95,7 +95,7 @@ LSCSTATUS LSC_update_seq_handler( ALOGD_IF(ese_debug_enabled, "%s: enter", fn); memset(&update_info, 0, sizeof(Lsc_ImageInfo_t)); if (dest != NULL) { - strcat(update_info.fls_RespPath, dest); + strlcat(update_info.fls_RespPath, dest, sizeof(update_info.fls_RespPath)); ALOGD_IF(ese_debug_enabled, "%s: Loader Service response data path/destination: %s", fn, dest); update_info.bytes_wrote = 0xAA; @@ -106,7 +106,7 @@ LSCSTATUS LSC_update_seq_handler( return LSCSTATUS_FAILED; } // memcpy(update_info.fls_path, (char*)Lsc_path, sizeof(Lsc_path)); - strcat(update_info.fls_path, name); + strlcat(update_info.fls_path, name, sizeof(update_info.fls_path)); ALOGD_IF(ese_debug_enabled, "Selected applet to install is: %s", update_info.fls_path); @@ -435,10 +435,6 @@ LSCSTATUS LSC_loadapplet(Lsc_ImageInfo_t* Os_info, LSCSTATUS status, while (!feof(Os_info->fp) && (Os_info->bytes_read < Os_info->fls_size)) { len_byte = 0; offset = 0; - /*Check if the certificate/ is verified or not*/ - if (status != LSCSTATUS_SUCCESS) { - goto exit; - } uint8_t temp_buf[1024]; memset(temp_buf, 0, sizeof(temp_buf)); @@ -572,7 +568,7 @@ LSCSTATUS LSC_Check_KeyIdentifier(Lsc_ImageInfo_t* Os_info, LSCSTATUS status, int32_t wNewLen) { static const char fn[] = "LSC_Check_KeyIdentifier"; status = LSCSTATUS_FAILED; - uint8_t read_buf[1024]; + uint8_t read_buf[1024] = {0}; uint16_t offset = 0, len_byte = 0; int32_t wLen; uint8_t certf_found = LSCSTATUS_FAILED; |
