]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix use-after-free in statefulhelper::submit() level-9 debug (#1859)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Mon, 15 Jul 2024 17:37:14 +0000 (17:37 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 15 Jul 2024 17:37:18 +0000 (17:37 +0000)
A debug statement in helper.cc dereferences a pointer which
might have been freed in helperStatefulDispatch.

Detected by Semgrep

src/helper.cc

index 197cd8f16a2a721dba9df3d2fc2687185f8b79d4..34267335e37d56625dc37c2a6408e05a013547fd 100644 (file)
@@ -681,14 +681,12 @@ statefulhelper::submit(const char *buf, HLPCB * callback, void *data, const Help
         helper_stateful_server *srv;
         if ((srv = StatefulGetFirstAvailable(this))) {
             reserveServer(srv);
-            helperStatefulDispatch(srv, r);
+            helperStatefulDispatch(srv, r); // may delete r
         } else
             StatefulEnqueue(this, r);
     }
 
-    debugs(84, DBG_DATA, "placeholder: '" << r->request.placeholder <<
-           "', " << Raw("buf", buf, (!buf?0:strlen(buf))));
-
+    // r may be dangling here
     syncQueueStats();
 }