[sr-dev] git:master:5e763029: kex: safety check for accessing CSeq in per method stats
Daniel-Constantin Mierla
miconda at gmail.com
Thu Oct 25 07:08:22 CEST 2018
Module: kamailio
Branch: master
Commit: 5e763029dc207c99796adc1c3ace71cf6de59446
URL: https://github.com/kamailio/kamailio/commit/5e763029dc207c99796adc1c3ace71cf6de59446
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-10-25T07:07:52+02:00
kex: safety check for accessing CSeq in per method stats
- GH #1687
---
Modified: src/modules/kex/core_stats.c
---
Diff: https://github.com/kamailio/kamailio/commit/5e763029dc207c99796adc1c3ace71cf6de59446.diff
Patch: https://github.com/kamailio/kamailio/commit/5e763029dc207c99796adc1c3ace71cf6de59446.patch
---
diff --git a/src/modules/kex/core_stats.c b/src/modules/kex/core_stats.c
index 2f51a1f955..ef4d85dad8 100644
--- a/src/modules/kex/core_stats.c
+++ b/src/modules/kex/core_stats.c
@@ -234,8 +234,17 @@ static int km_cb_req_stats(struct sip_msg *msg,
static int km_cb_rpl_stats_by_method(struct sip_msg *msg,
unsigned int flags, void *param)
{
- int method = get_cseq(msg)->method_id;
- int group = msg->first_line.u.reply.statuscode / 100 - 1;
+ int method = 0;
+ int group = 0;
+
+ if(msg==NULL) {
+ return -1;
+ }
+ if (!msg->cseq && (parse_headers(msg, HDR_CSEQ_F, 0) < 0 || !msg->cseq)) {
+ return -1;
+ }
+ method = get_cseq(msg)->method_id;
+ group = msg->first_line.u.reply.statuscode / 100 - 1;
if (group >= 0 && group <= 5) {
switch(method) {
More information about the sr-dev
mailing list