[sr-dev] git:master:7d52bf6c: cdp: fix two errors from coverty scan (missing check, var initialization)

Henning Westerholt hw at kamailio.org
Sun Dec 30 01:21:13 CET 2018


Module: kamailio
Branch: master
Commit: 7d52bf6ce7188eaa57690766c231e55b5509db4f
URL: https://github.com/kamailio/kamailio/commit/7d52bf6ce7188eaa57690766c231e55b5509db4f

Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2018-12-30T00:15:46+01:00

cdp: fix two errors from coverty scan (missing check, var initialization)

- remove library call can fail, test for the error and log it
- initialize the msghdr variable with a memset

---

Modified: src/modules/cdp/receiver.c

---

Diff:  https://github.com/kamailio/kamailio/commit/7d52bf6ce7188eaa57690766c231e55b5509db4f.diff
Patch: https://github.com/kamailio/kamailio/commit/7d52bf6ce7188eaa57690766c231e55b5509db4f.patch

---

diff --git a/src/modules/cdp/receiver.c b/src/modules/cdp/receiver.c
index 2b4da266e3..6257d15362 100644
--- a/src/modules/cdp/receiver.c
+++ b/src/modules/cdp/receiver.c
@@ -157,10 +157,14 @@ static int make_send_pipe(serviced_peer_t *sp)
  */
 static void close_send_pipe(serviced_peer_t *sp)
 {
+	int tmp;
 	if (sp->send_pipe_name.s) {
 		close(sp->send_pipe_fd);
 		close(sp->send_pipe_fd_out);
-		remove(sp->send_pipe_name.s);
+		tmp = remove(sp->send_pipe_name.s);
+		if (tmp == -1) {
+			LM_ERR("could not remove send pipe\n");
+		}
 		shm_free(sp->send_pipe_name.s);
 		sp->send_pipe_name.s=0;
 		sp->send_pipe_name.len=0;
@@ -269,6 +273,7 @@ static int send_fd(int pipe_fd,int fd, peer *p)
 	struct iovec iov[1];
 	int ret;
 	int *tmp = NULL;
+	memset(&msg, 0, sizeof(struct msghdr));
 
 #ifdef HAVE_MSGHDR_MSG_CONTROL
 	struct cmsghdr* cmsg;




More information about the sr-dev mailing list