[sr-dev] git:5.2:eed2a7f8: core: fix an error in check_via_address, reported from Mojtaba, mespio at gmail dot com
Henning Westerholt
hw at kamailio.org
Sun Dec 30 18:53:12 CET 2018
Module: kamailio
Branch: 5.2
Commit: eed2a7f86129950e5f20a4b4010a7e67ea04eac5
URL: https://github.com/kamailio/kamailio/commit/eed2a7f86129950e5f20a4b4010a7e67ea04eac5
Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2018-12-30T18:41:44+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/eed2a7f86129950e5f20a4b4010a7e67ea04eac5.diff
Patch: https://github.com/kamailio/kamailio/commit/eed2a7f86129950e5f20a4b4010a7e67ea04eac5.patch
---
diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index 08e518a9d8..038b02f461 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -179,7 +179,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{
More information about the sr-dev
mailing list