summaryrefslogtreecommitdiffhomepage
path: root/eval.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-07 15:57:59 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-07 16:30:34 +0200
commit5d43bdb0d19823592dddd5f27e203a54f63e1441 (patch)
tree697b3a6cc5858587f213812085b416a6e1e61067 /eval.c
parenta35469d34be384d3a5ae7b852acb6d980f6b702e (diff)
eval: fix segmentation when attempting to concat a string with null
A typo in the code lead to a null pointer dereference. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 7e45f52..745a97c 100644
--- a/eval.c
+++ b/eval.c
@@ -1039,7 +1039,7 @@ ut_execute_arith(struct ut_state *state, uint32_t off)
(json_object_is_type(v1, json_type_string) ||
json_object_is_type(v2, json_type_string))) {
s1 = v1 ? json_object_get_string(v1) : "null";
- s2 = v1 ? json_object_get_string(v2) : "null";
+ s2 = v2 ? json_object_get_string(v2) : "null";
len1 = strlen(s1);
len2 = strlen(s2);
s = calloc(1, len1 + len2 + 1);