[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sr-dev
Subject:    [sr-dev] git:5.1:b075e6fc: core: fix an error in check_via_address, reported from  Mojtaba, mespio a
From:       Henning Westerholt <hw () kamailio ! org>
Date:       2018-12-30 17:53:10
Message-ID: E1gdfGw-0000cq-AM () www ! kamailio ! org
[Download RAW message or body]

Module: kamailio
Branch: 5.1
Commit: b075e6fcb7435d168241bc9bc83e87b70b4d08d4
URL: https://github.com/kamailio/kamailio/commit/b075e6fcb7435d168241bc9bc83e87b70b4d08d4

Author: Henning Westerholt <hw@kamailio.org>
Committer: Henning Westerholt <hw@kamailio.org>
Date: 2018-12-30T18:41:39+01:00

core: fix an error in check_via_address, reported from 	Mojtaba, mespio at gmail dot com

- fix an error in check_via_address, reported from  Mojtaba, mespio at gmail dot com
- use the same logic for IPv4 string comparison as for IPv6
- the old comparison could return true for e.g. via="192.168.1.1", src="192.1.1.100"
- the new logic is also faster for the trivial case with different string length

(cherry picked from commit 98ee014a88ca951d82a0389f0be119078ba525f7)

---

Modified: src/core/msg_translator.c

---

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

---

diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index 5b0c726378..f34637b6f1 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -176,7 +176,7 @@ static int check_via_address(struct ip_addr* ip, str *name,
 				LM_CRIT("invalid Via host name\n");
 				return -1;
 			}
-			if (strncmp(name->s, s, name->len)==0)
+			if (len==name->len&&(strncmp(name->s, s, name->len)==0))
 				return 0;
 		}
 	}else{


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic