summaryrefslogtreecommitdiffhomepage
path: root/eval.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-21 13:08:09 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-21 13:08:09 +0200
commit525a0a93eafad836b0680e1c7a9fe0f8a0387fbf (patch)
treeea82d356e9f308e0b6f0da10f09dc42d7dde02c1 /eval.c
parent64d998474dc4e0c27b6f9ffa054a556d90ff7d36 (diff)
eval: fix potential null pointer access when computing operands
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 0728ba2..280a808 100644
--- a/eval.c
+++ b/eval.c
@@ -821,8 +821,10 @@ _ut_get_operands(struct ut_state *state, struct ut_op *op, size_t n, struct json
if (child && child->is_list)
v[i] = ut_execute_list(state, ut_get_off(state, child));
- else
+ else if (child)
v[i] = ut_execute_op(state, ut_get_off(state, child));
+ else
+ v[i] = NULL;
if (ut_is_type(v[i], T_EXCEPTION)) {
for (j = 0; j < i; j++)