Module: kamailio Branch: master Commit: 80689e22bc83aff78d8fd53d4a33bcb68c913c19 URL: https://github.com/kamailio/kamailio/commit/80689e22bc83aff78d8fd53d4a33bcb68c913c19
Author: Victor Seva <[email protected]> Committer: Victor Seva <[email protected]> Date: 2021-04-15T11:41:20+02:00 pv_headers: safety check for xavi key count * check that we have keys to put into the hash before allocating anything * check table field instead of size just to make analyzer happy --- Modified: src/modules/pv_headers/pvh_func.c --- Diff: https://github.com/kamailio/kamailio/commit/80689e22bc83aff78d8fd53d4a33bcb68c913c19.diff Patch: https://github.com/kamailio/kamailio/commit/80689e22bc83aff78d8fd53d4a33bcb68c913c19.patch --- diff --git a/src/modules/pv_headers/pvh_func.c b/src/modules/pv_headers/pvh_func.c index 90feddeefd..7afc39d1a8 100644 --- a/src/modules/pv_headers/pvh_func.c +++ b/src/modules/pv_headers/pvh_func.c @@ -174,6 +174,10 @@ int pvh_apply_headers(struct sip_msg *msg) return -1; } keys_count = pvh_xavi_keys_count(&sub); + if(keys_count <= 0) { + LM_ERR("no keys found: %.*s\n", xavi_name.len, xavi_name.s); + return -1; + } if(str_hash_alloc(&rm_hdrs, keys_count) < 0) { PKG_MEM_ERROR; return -1; @@ -294,7 +298,7 @@ int pvh_apply_headers(struct sip_msg *msg) res = 1; err: - if(rm_hdrs.size) + if(rm_hdrs.table) pvh_str_hash_free(&rm_hdrs); return res; } _______________________________________________ Kamailio (SER) - Development Mailing List [email protected] https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
