[sr-dev] git:5.2:7c219b4a: core: init local structs to avoid use of garbage values

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 7 10:48:42 CEST 2019


Module: kamailio
Branch: 5.2
Commit: 7c219b4a7a2e6a8448d72789587ca10f27fcf36c
URL: https://github.com/kamailio/kamailio/commit/7c219b4a7a2e6a8448d72789587ca10f27fcf36c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-10-07T10:42:17+02:00

core: init local structs to avoid use of garbage values

(cherry picked from commit dfe8db758f84f5e88e0cb35b80a65dcd48158897)

---

Modified: src/core/forward.c
Modified: src/core/ip_addr.h

---

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

---

diff --git a/src/core/forward.c b/src/core/forward.c
index a6bf221a79..11933cf132 100644
--- a/src/core/forward.c
+++ b/src/core/forward.c
@@ -471,6 +471,7 @@ int forward_request(struct sip_msg* msg, str* dst, unsigned short port,
 
 	prev_send_sock=0;
 	err=0;
+	memset(&dns_srv_h, 0, sizeof(struct dns_srv_handle));
 #endif
 
 	buf=0;
diff --git a/src/core/ip_addr.h b/src/core/ip_addr.h
index aa5af2b2f4..df57c5faa3 100644
--- a/src/core/ip_addr.h
+++ b/src/core/ip_addr.h
@@ -420,6 +420,7 @@ static inline void su2ip_addr(struct ip_addr* ip, union sockaddr_union* su)
 			break;
 		default:
 			LM_CRIT("unknown address family %d\n", su->s.sa_family);
+			memset(ip, 0, sizeof(ip_addr_t));
 	}
 }
 




More information about the sr-dev mailing list