retoorandClaude Sonnet 5 54499eef4e fix(realtime): reject WebDAV COPY/MOVE destinations nested inside the source
ResourceTree::copy inserted into entries_ (a std::map) while range-iterating
that same map. When dst fell inside src (e.g. /dav/a -> /dav/a/b), each
newly inserted entry was discovered by the ongoing iteration and copied
again, so the loop never converged and memory grew without bound
(MOLO-DAV-001, CWE-674/CWE-400). RFC 4918 9.8.3/9.9.3 require servers to
reject this shape before mutating anything, so copy() now checks dst == src
or dst nested under src and fails immediately with no side effects.
move() inherits the fix since it calls copy() first.

As defense in depth, copy() also no longer mutates entries_ while
iterating it: it collects the (target, resource) pairs into a local
vector first, then applies them in a second pass, so the same class of
bug cannot recur even if the containment check is ever bypassed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-25 20:06:30 +01:00
S
Description
moloapp
5.2 MiB
Languages
C++ 90%
Python 3.2%
Pawn 3.2%
POV-Ray SDL 1.3%
JavaScript 1.1%
Other 1.1%