From 4df37fd34562db49322a8447e7c91974ed0de472 Mon Sep 17 00:00:00 2001 From: biju-vi <151033276+biju-vi@users.noreply.github.com> Date: Thu, 6 Aug 2026 16:09:27 +0000 Subject: [PATCH 1/4] LTE-3039: IDM is stuck in XLE causing XB to not discover Remote Device Reason for change: Exit from loop if socket is not usable Test Procedure: NA Risks: Low Signed-off-by: biju.vijayanindiradevi@sky.uk --- source/InterDeviceManager/Idm_msg_process.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/InterDeviceManager/Idm_msg_process.c b/source/InterDeviceManager/Idm_msg_process.c index 6cc17c8..031cf7a 100644 --- a/source/InterDeviceManager/Idm_msg_process.c +++ b/source/InterDeviceManager/Idm_msg_process.c @@ -517,6 +517,8 @@ char* IDM_Incoming_FT_Response(connection_info_t* conn_info,payload_t* payload) } else{ CcspTraceError(("(%s:%d) Data encryption failed (Err: %d)\n", __FUNCTION__, __LINE__,bytes)); + // Exit from loop if socket is not usable ot there is no data to read + break; } } if(buf){ @@ -876,6 +878,8 @@ char* IDM_SFT_receive(connection_info_t* conn_info,void* payload) } else{ CcspTraceError(("(%s:%d) Data encryption failed (Err: %d)\n", __FUNCTION__, __LINE__,bytes)); + // Exit from loop if socket is not usable or no data to read + break; } } if(buf){ From 198fe76691bf6f351519f725fb34e62d187546ad Mon Sep 17 00:00:00 2001 From: biju-vi <151033276+biju-vi@users.noreply.github.com> Date: Thu, 6 Aug 2026 16:09:27 +0000 Subject: [PATCH 2/4] LTE-3039: IDM is stuck in XLE causing XB to not discover Remote Device Reason for change: Exit from loop if socket is not usable Test Procedure: NA Risks: Low Signed-off-by: biju.vijayanindiradevi@sky.uk --- source/InterDeviceManager/Idm_msg_process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/InterDeviceManager/Idm_msg_process.c b/source/InterDeviceManager/Idm_msg_process.c index 031cf7a..d80d691 100644 --- a/source/InterDeviceManager/Idm_msg_process.c +++ b/source/InterDeviceManager/Idm_msg_process.c @@ -516,8 +516,8 @@ char* IDM_Incoming_FT_Response(connection_info_t* conn_info,payload_t* payload) length+=bytes; } else{ - CcspTraceError(("(%s:%d) Data encryption failed (Err: %d)\n", __FUNCTION__, __LINE__,bytes)); - // Exit from loop if socket is not usable ot there is no data to read + CcspTraceError(("(%s:%d) Socket Read Error (bytes read: %d)\n", __FUNCTION__, __LINE__,bytes)); + // Exit from loop if socket is not usable or there is no data to read break; } } @@ -877,7 +877,7 @@ char* IDM_SFT_receive(connection_info_t* conn_info,void* payload) length+=bytes; } else{ - CcspTraceError(("(%s:%d) Data encryption failed (Err: %d)\n", __FUNCTION__, __LINE__,bytes)); + CcspTraceError(("(%s:%d) Socket Read Error (bytes read: %d)\n", __FUNCTION__, __LINE__,bytes)); // Exit from loop if socket is not usable or no data to read break; } From 7dff97b813a62ef354870f7cb40586e5a630d7fc Mon Sep 17 00:00:00 2001 From: biju-vi <151033276+biju-vi@users.noreply.github.com> Date: Thu, 6 Aug 2026 16:09:27 +0000 Subject: [PATCH 3/4] LTE-3039: IDM is stuck in XLE causing XB to not discover Remote Device Reason for change: Exit from loop if socket is not usable Test Procedure: NA Risks: Low Signed-off-by: biju.vijayanindiradevi@sky.uk --- source/InterDeviceManager/Idm_msg_process.c | 27 ++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/source/InterDeviceManager/Idm_msg_process.c b/source/InterDeviceManager/Idm_msg_process.c index d80d691..bcde317 100644 --- a/source/InterDeviceManager/Idm_msg_process.c +++ b/source/InterDeviceManager/Idm_msg_process.c @@ -498,7 +498,7 @@ char* IDM_Incoming_FT_Response(connection_info_t* conn_info,payload_t* payload) while(lengthenc.ssl != NULL){ - bytes = SSL_read(conn_info->enc.ssl, buf, total_bytes-bytes); + bytes = SSL_read(conn_info->enc.ssl, buf, total_bytes - length); } else{ CcspTraceError(("%s:%d ssl session is null\n",__FUNCTION__,__LINE__)); @@ -508,7 +508,7 @@ char* IDM_Incoming_FT_Response(connection_info_t* conn_info,payload_t* payload) return FT_ERROR; } #else - bytes = read( conn_info->conn , buf, total_bytes-bytes); + bytes = read( conn_info->conn , buf, total_bytes - length); #endif CcspTraceInfo(("bytes transfered : %d\n",bytes)); if(bytes > 0){ @@ -517,7 +517,7 @@ char* IDM_Incoming_FT_Response(connection_info_t* conn_info,payload_t* payload) } else{ CcspTraceError(("(%s:%d) Socket Read Error (bytes read: %d)\n", __FUNCTION__, __LINE__,bytes)); - // Exit from loop if socket is not usable or there is no data to read + // Exit from loop if socket is not usable or broken break; } } @@ -526,6 +526,13 @@ char* IDM_Incoming_FT_Response(connection_info_t* conn_info,payload_t* payload) } } fclose(fptr); + if(length < total_bytes) + { + // we couldn't read full bytes + remove(req->output_location); + free(req); + return FT_ERROR; + } free(req); return FT_SUCCESS; } @@ -858,7 +865,8 @@ char* IDM_SFT_receive(connection_info_t* conn_info,void* payload) while(lengthenc.ssl != NULL){ - bytes = SSL_read(conn_info->enc.ssl, buf, total_bytes-bytes); + // read remianing bytes + bytes = SSL_read(conn_info->enc.ssl, buf, total_bytes - length); } else{ CcspTraceError(("%s:%d ssl session is null\n",__FUNCTION__,__LINE__)); @@ -869,7 +877,8 @@ char* IDM_SFT_receive(connection_info_t* conn_info,void* payload) return FT_ERROR; } #else - bytes = read( conn_info->conn , buf, total_bytes-bytes); + // read remaining bytes + bytes = read( conn_info->conn , buf, total_bytes - length); #endif CcspTraceInfo(("bytes transfered : %d\n",bytes)); if(bytes > 0){ @@ -878,7 +887,7 @@ char* IDM_SFT_receive(connection_info_t* conn_info,void* payload) } else{ CcspTraceError(("(%s:%d) Socket Read Error (bytes read: %d)\n", __FUNCTION__, __LINE__,bytes)); - // Exit from loop if socket is not usable or no data to read + // Exit from loop if socket is not usable or broken break; } } @@ -894,6 +903,12 @@ char* IDM_SFT_receive(connection_info_t* conn_info,void* payload) IdmMgrDml_GetConfigData_release(pidmDmlInfo); return FT_ERROR; } + if(length < total_bytes) + { + // we couldn't read full bytes. Remove partially written file + remove(Data->param_name); + return FT_ERROR; + } return FT_SUCCESS; } From 86467705115e9ac20d06453a061cdb7482a87a10 Mon Sep 17 00:00:00 2001 From: biju-vi <151033276+biju-vi@users.noreply.github.com> Date: Thu, 6 Aug 2026 16:09:27 +0000 Subject: [PATCH 4/4] LTE-3039: IDM is stuck in XLE causing XB to not discover Remote Device Reason for change: Exit from loop if socket is not usable Test Procedure: NA Risks: Low Signed-off-by: biju.vijayanindiradevi@sky.uk --- source/InterDeviceManager/Idm_msg_process.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/InterDeviceManager/Idm_msg_process.c b/source/InterDeviceManager/Idm_msg_process.c index bcde317..1651e2a 100644 --- a/source/InterDeviceManager/Idm_msg_process.c +++ b/source/InterDeviceManager/Idm_msg_process.c @@ -502,6 +502,7 @@ char* IDM_Incoming_FT_Response(connection_info_t* conn_info,payload_t* payload) } else{ CcspTraceError(("%s:%d ssl session is null\n",__FUNCTION__,__LINE__)); + remove(req->output_location); fclose(fptr); free(buf); free(req); @@ -865,11 +866,12 @@ char* IDM_SFT_receive(connection_info_t* conn_info,void* payload) while(lengthenc.ssl != NULL){ - // read remianing bytes + // read remaining bytes bytes = SSL_read(conn_info->enc.ssl, buf, total_bytes - length); } else{ CcspTraceError(("%s:%d ssl session is null\n",__FUNCTION__,__LINE__)); + remove(Data->param_name); fclose(fptr); if(buf){ free(buf);