[sr-dev] git:5.5:e77e4ad4: nathelper: Fix uninitialized data

Daniel-Constantin Mierla miconda at gmail.com
Wed Mar 2 12:47:11 CET 2022


Module: kamailio
Branch: 5.5
Commit: e77e4ad4953aac413d06ceb3954736b81ac30355
URL: https://github.com/kamailio/kamailio/commit/e77e4ad4953aac413d06ceb3954736b81ac30355

Author: Matthias Urlichs <matthias at urlichs.de>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-03-02T10:14:38+01:00

nathelper: Fix uninitialized data

- the IP checksum is part of the header and must be zeroed before checksumming
- also silence another (benign) warning

(cherry picked from commit 7cbbd8fb22ac0d57a5dd3883dee185b3bc0601e2)

---

Modified: src/modules/nathelper/nathelper.c

---

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

---

diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c
index 9e45a61079..3cb138ebdd 100644
--- a/src/modules/nathelper/nathelper.c
+++ b/src/modules/nathelper/nathelper.c
@@ -1615,7 +1615,7 @@ static inline int replace_sdp_ip(
 {
 	str body1, oldip, newip;
 	str body = *org_body;
-	int pf, pf1 = 0;
+	int pf = 0, pf1 = 0;
 	str body2;
 	char *bodylimit = body.s + body.len;
 	int ret;
@@ -1974,6 +1974,7 @@ static int send_raw(const char *buf, int buf_len, union sockaddr_union *to,
 	ip->ip_off = 0;
 	ip->ip_ttl = 69;
 	ip->ip_p = 17;
+	ip->ip_sum = 0;
 	ip->ip_src.s_addr = s_ip;
 	ip->ip_dst.s_addr = to->sin.sin_addr.s_addr;
 




More information about the sr-dev mailing list