Skip to content

Commit

Permalink
Add check for null strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Anilm3 committed Oct 13, 2023
1 parent c096ee8 commit e81f79c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Copyright 2021 Datadog, Inc.

#include <charconv>
#include <iostream>
#include <memory>

#include "exception.hpp"
Expand Down Expand Up @@ -50,7 +51,11 @@ std::optional<event::match> 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;
Expand Down

0 comments on commit e81f79c

Please sign in to comment.