From 0ef767a500ad47f2791fb1f065c29c08543cd119 Mon Sep 17 00:00:00 2001 From: Eduard Bagdasaryan Date: Tue, 5 Nov 2024 14:21:19 +0000 Subject: [PATCH] Nil request dereference in ACLExtUser and SourceDomainCheck ACLs (#1931) ACLExtUser-based ACLs (i.e. ext_user and ext_user_regex) dereferenced a nil request pointer when they were used in a context without a request (e.g., when honoring on_unsupported_protocol). SourceDomainCheck-based ACLs (i.e. srcdomain and srcdom_regex) have a similar bug, although we do not know whether broken slow ACL code is reachable without a request (e.g., on_unsupported_protocol tests cannot reach that code until that directive starts supporting slow ACLs). This change does not start to require request presence for these two ACLs to avoid breaking any existing configurations that "work" without one. --- src/acl/ExtUser.h | 1 + src/acl/SourceDomain.cc | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/acl/ExtUser.h b/src/acl/ExtUser.h index 3faaeeb0f06..a851be8824f 100644 --- a/src/acl/ExtUser.h +++ b/src/acl/ExtUser.h @@ -27,6 +27,7 @@ class ACLExtUser : public Acl::Node char const *typeString() const override; void parse() override; int match(ACLChecklist *checklist) override; + bool requiresRequest() const override { return true; } SBufList dump() const override; bool empty () const override; diff --git a/src/acl/SourceDomain.cc b/src/acl/SourceDomain.cc index f3267f15bba..343e0d7ae15 100644 --- a/src/acl/SourceDomain.cc +++ b/src/acl/SourceDomain.cc @@ -30,7 +30,11 @@ LookupDone(const char *, const Dns::LookupDetails &details, void *data) { ACLFilledChecklist *checklist = Filled((ACLChecklist*)data); checklist->markSourceDomainChecked(); - checklist->request->recordLookup(details); + if (checklist->request) + checklist->request->recordLookup(details); + else + debugs(28, 3, "no request to recordLookup()"); + checklist->resumeNonBlockingCheck(); }