Module: kamailio
Branch: 5.6
Commit: b524321a4871c349e6ebb464ea018e138bc6d5ed
URL:
https://github.com/kamailio/kamailio/commit/b524321a4871c349e6ebb464ea018e1…
Author: Victor Seva <vseva(a)sipwise.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-07-17T10:35:40+02:00
app_lua: fix crash on exausted memory scenario
(cherry picked from commit ef94da7bac8e2aaf5a452d7b7dc3e2b544153ff6)
---
Modified: src/modules/app_lua/app_lua_api.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b524321a4871c349e6ebb464ea018e1…
Patch:
https://github.com/kamailio/kamailio/commit/b524321a4871c349e6ebb464ea018e1…
---
diff --git a/src/modules/app_lua/app_lua_api.c b/src/modules/app_lua/app_lua_api.c
index 0a1d13532cc..1010fc5b005 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;