Module: kamailio
Branch: master
Commit: ef94da7bac8e2aaf5a452d7b7dc3e2b544153ff6
URL:
https://github.com/kamailio/kamailio/commit/ef94da7bac8e2aaf5a452d7b7dc3e2b…
Author: Victor Seva <vseva(a)sipwise.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2023-03-24T10:33:41+01:00
app_lua: fix crash on exausted memory scenario
---
Modified: src/modules/app_lua/app_lua_api.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ef94da7bac8e2aaf5a452d7b7dc3e2b…
Patch:
https://github.com/kamailio/kamailio/commit/ef94da7bac8e2aaf5a452d7b7dc3e2b…
---
diff --git a/src/modules/app_lua/app_lua_api.c b/src/modules/app_lua/app_lua_api.c
index b808d229d5a..df192b2b64e 100644
--- a/src/modules/app_lua/app_lua_api.c
+++ b/src/modules/app_lua/app_lua_api.c
@@ -912,6 +912,10 @@ void sr_kemi_lua_push_dict(lua_State *L, sr_kemi_dict_item_t *item)
{
void
sr_kemi_lua_push_dict_item(lua_State *L, sr_kemi_dict_item_t *item)
{
+ if(!item) {
+ LM_CRIT("BUG: dict field empty\n");
+ return;
+ }
switch(item->vtype) {
case SR_KEMIP_NONE:
LM_CRIT("BUG: vtype is NONE\n");
@@ -951,6 +955,10 @@ sr_kemi_lua_push_dict_item(lua_State *L, sr_kemi_dict_item_t *item)
*/
int sr_kemi_lua_return_xval(lua_State* L, sr_kemi_t *ket, sr_kemi_xval_t *rx)
{
+ if(!rx) {
+ LM_CRIT("BUG: xval field empty\n");
+ return 0;
+ }
switch(rx->vtype) {
case SR_KEMIP_NONE:
return 0;