From e81f79ce9db5ff84186547372926eb3ee065effc Mon Sep 17 00:00:00 2001 From: Anil Mahtani <929854+Anilm3@users.noreply.github.com> Date: Fri, 13 Oct 2023 15:23:38 +0100 Subject: [PATCH] Add check for null strings --- src/expression.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/expression.cpp b/src/expression.cpp index 71a36e47a..bba38f772 100644 --- a/src/expression.cpp +++ b/src/expression.cpp @@ -5,6 +5,7 @@ // Copyright 2021 Datadog, Inc. #include +#include #include #include "exception.hpp" @@ -50,7 +51,11 @@ std::optional expression::evaluator::eval_object(const ddwaf_objec { ddwaf_object src = *object; - if (object->type == DDWAF_OBJ_STRING) { + if (src.type == DDWAF_OBJ_STRING) { + if (src.stringValue == nullptr) { + return std::nullopt; + } + src.nbEntries = find_string_cutoff(src.stringValue, src.nbEntries, limits); if (!transformers.empty()) { ddwaf_object dst;