Module: kamailio
Branch: master
Commit: 883f6b77211a76b35a9df570a8ddbbc344b05472
URL:
https://github.com/kamailio/kamailio/commit/883f6b77211a76b35a9df570a8ddbbc…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-07-07T09:27:18+02:00
kex: safety checks when iterating stats list
- GH #3186
---
Modified: src/modules/kex/mod_stats.c
---
Diff:
https://github.com/kamailio/kamailio/commit/883f6b77211a76b35a9df570a8ddbbc…
Patch:
https://github.com/kamailio/kamailio/commit/883f6b77211a76b35a9df570a8ddbbc…
---
diff --git a/src/modules/kex/mod_stats.c b/src/modules/kex/mod_stats.c
index 65cce371eee..272c5fb3397 100644
--- a/src/modules/kex/mod_stats.c
+++ b/src/modules/kex/mod_stats.c
@@ -85,14 +85,14 @@ static int rpc_mod_is_printed_one(mem_counter *stats, mem_counter
*current)
{
mem_counter *iter;
- if(stats == NULL || current == NULL) {
+ if(stats == NULL || current == NULL || current->mname == NULL) {
LM_ERR("invalid parameter\n");
return 1;
}
iter = stats;
while(iter && iter != current) {
- if(strcmp(iter->mname, current->mname) == 0) {
+ if(iter->mname != NULL && strcmp(iter->mname, current->mname) == 0) {
return 1;
}
iter = iter->next;