2
0
Эх сурвалжийг харах

topoh: check returned pointer when decoding call-id

(cherry picked from commit b5ce9d8f9a1b1fd705ad4b533e7cbc9166a3f577)
(cherry picked from commit 77eebed8be1930fdb03f4fce0a1caac1bd45c583)
(cherry picked from commit c14bb3cb8ff6ba7df81f1955f629ee169da0edd6)
Daniel-Constantin Mierla 6 жил өмнө
parent
commit
0c2054114b

+ 4 - 0
src/modules/topoh/th_msg.c

@@ -541,6 +541,10 @@ int th_unmask_callid_str(str *icallid, str *ocallid)
 	}
 	}
 	out.s = th_mask_decode(icallid->s, icallid->len,
 	out.s = th_mask_decode(icallid->s, icallid->len,
 					&th_callid_prefix, 0, &out.len);
 					&th_callid_prefix, 0, &out.len);
+	if(out.s == NULL) {
+		LM_ERR("failed to decode call-id\n");
+		return -2;
+	}
 	if(out.len>=TH_CALLID_SIZE) {
 	if(out.len>=TH_CALLID_SIZE) {
 		pkg_free(out.s);
 		pkg_free(out.s);
 		LM_ERR("not enough callid buf size (needed %d)\n", out.len);
 		LM_ERR("not enough callid buf size (needed %d)\n", out.len);