Browse code

kex: add additional safety checks for printing, based on PR #3250 from bensly-shanmugam

Henning Westerholt authored on 21/09/2022 18:34:04
Showing 1 changed files
... ...
@@ -86,7 +86,14 @@ static const char* rpc_mod_mem_statsx_doc[2] = {
86 86
 
87 87
 /* test if the current mod info was already printed */
88 88
 static int rpc_mod_is_printed_one(mem_counter *stats, mem_counter *current) {
89
-	mem_counter *iter = stats;
89
+	mem_counter *iter;
90
+
91
+	if ( stats == NULL || current == NULL )
92
+	{
93
+		LM_ERR("invalid parameter\n");
94
+		return 1;
95
+	}
96
+	iter = stats;
90 97
 
91 98
 	while (iter && iter != current) {
92 99
 		if (strcmp(iter->mname, current->mname) == 0) {