Module: kamailio
Branch: master
Commit: d8955fc350b48d0c4ca359d03cb9954a48998658
URL:
https://github.com/kamailio/kamailio/commit/d8955fc350b48d0c4ca359d03cb9954…
Author: Sergey Safarov <s.safarov(a)gmail.com>
Committer: Sergey Safarov <s.safarov(a)gmail.com>
Date: 2021-09-15T16:14:13+03:00
kazoo: fixed crash when json body is NULL
fixes GH #2794
---
Modified: src/modules/kazoo/kz_json.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d8955fc350b48d0c4ca359d03cb9954…
Patch:
https://github.com/kamailio/kamailio/commit/d8955fc350b48d0c4ca359d03cb9954…
---
diff --git a/src/modules/kazoo/kz_json.c b/src/modules/kazoo/kz_json.c
index 5ab8f68c79..0e5f2e8b10 100644
--- a/src/modules/kazoo/kz_json.c
+++ b/src/modules/kazoo/kz_json.c
@@ -276,6 +276,11 @@ struct json_object* kz_json_parse(const char *str)
struct json_tokener* tok;
struct json_object* obj;
+ if (str == NULL || str[0] == 0) {
+ LM_ERR("Error parsing json: empty string\n");
+ return NULL;
+ }
+
tok = json_tokener_new();
if (!tok) {
LM_ERR("Error parsing json: could not allocate tokener\n");