[sr-dev] git:master:198969bb: modules/sipt: fix size check for optional pointer

Torrey Searle tsearle at gmail.com
Wed Feb 25 08:37:11 CET 2015


Module: kamailio
Branch: master
Commit: 198969bb4b2883530c6865f0c6f2afb574cead56
URL: https://github.com/kamailio/kamailio/commit/198969bb4b2883530c6865f0c6f2afb574cead56

Author: Torrey Searle <tsearle at gmail.com>
Committer: Torrey Searle <tsearle at gmail.com>
Date: 2015-02-24T17:36:14+01:00

modules/sipt: fix size check for optional pointer

---

Modified: modules/sipt/ss7_parser.c

---

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

---

diff --git a/modules/sipt/ss7_parser.c b/modules/sipt/ss7_parser.c
index 9315e43..e7554f8 100644
--- a/modules/sipt/ss7_parser.c
+++ b/modules/sipt/ss7_parser.c
@@ -316,13 +316,14 @@ int isup_update_bci_1(struct sdp_mangler * mangle, int charge_indicator, int cal
 		return 1;
 	}
 
-	if (len < sizeof(struct isup_acm_fixed))
+	// add minus 1 because the optinal pointer is optional
+	if (len < sizeof(struct isup_acm_fixed) -1 )
 		return -1;
 
 	bci = (charge_indicator & 0x3) | ((called_status & 0x3)<<2) |
 		((called_category & 0x3)<<4) | ((e2e_indicator & 0x3)<<6);
 
-	add_body_segment(mangle, offsetof(struct isup_acm_fixed, backwards_call_ind), &bci, 1);
+	replace_body_segment(mangle, offsetof(struct isup_acm_fixed, backwards_call_ind), 1, &bci, 1);
 
 	return sizeof(struct isup_acm_fixed);
 }




More information about the sr-dev mailing list