diff --git a/source/lm/Makefile.am b/source/lm/Makefile.am index fac3ffc..d26ce79 100644 --- a/source/lm/Makefile.am +++ b/source/lm/Makefile.am @@ -16,7 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ########################################################################## -AM_CFLAGS = +AM_CFLAGS = -Wno-error=format ACLOCAL_AMFLAGS = -I m4 diff --git a/source/lm/device_presence_detection.c b/source/lm/device_presence_detection.c index 198285d..8684f25 100644 --- a/source/lm/device_presence_detection.c +++ b/source/lm/device_presence_detection.c @@ -152,7 +152,10 @@ int PresenceDetection_Init() pDetectionObject = NULL; return -1; } + // COVERITY ISSUE: Unchecked return value - MEDIUM PRIORITY + // pthread_mutex_init can fail and return non-zero, but we don't check it pthread_mutex_init(&PresenceDetectionMutex,0); + memset(pDetectionObject->ppdevlist, 0, MAX_NUM_OF_DEVICE * sizeof(PLmPresenceDeviceInfo)); } else { @@ -638,7 +641,11 @@ static int sendNetlinkMessage(int iSocketFd, struct nlmsghdr * pNlMsgHdr) void sendProbeRequest (int iIpVersion, char * pIpAddress, char * pIface) { #define PROBE_BUFF_SIZE 256 - if ((NULL == pIpAddress) || (NULL == pIface)) + // COVERITY ISSUE: Moved NULL check after pointer usage - NULL POINTER DEREFERENCE + char *tempIpAddr = pIpAddress; + int ipLen = strlen(pIpAddress); // POTENTIAL NULL DEREFERENCE if pIpAddress is NULL + + if ((NULL == tempIpAddr) || (NULL == pIface)) { CcspTraceError(("%s:%d Invalid input parameter\n",__FUNCTION__,__LINE__)); return; diff --git a/source/lm/lm_api.c b/source/lm/lm_api.c index 8321036..ff368e7 100644 --- a/source/lm/lm_api.c +++ b/source/lm/lm_api.c @@ -83,6 +83,12 @@ int lm_send_rev(void *cmd, int size, void *buff, int buff_size) return LM_RET_ERR; } + // COVERITY ISSUE: Resource leak - fd not closed on null pointer check failure + if(cmd == NULL || buff == NULL){ + LM_LOG(("Null pointer passed\n")); + return LM_RET_ERR; // fd is not closed here - RESOURCE LEAK + } + ret = write(fd, cmd, size); CHK_GOTO_TAG((ret <= 0), RET);