Skip to content

A PROPFIND on an exact cache entry crashes proxytrack#829

Open
xroche wants to merge 3 commits into
masterfrom
fix/proxytrack-dav-default-doc
Open

A PROPFIND on an exact cache entry crashes proxytrack#829
xroche wants to merge 3 commits into
masterfrom
fix/proxytrack-dav-default-doc

Conversation

@xroche

@xroche xroche commented Jul 27, 2026

Copy link
Copy Markdown
Owner

proxytrack dies on one PROPFIND whose path names an exact cache entry. PT_Enumerate() reports that entry's own default document under an empty name, and the WebDAV listing loop indexed it at [thisUrlLen - 1] with an unsigned length, so an empty name reads four gigabytes past the string. The crash takes the listener down rather than the connection, and nothing authenticates the request.

The isDefault argument a few lines below already tests thisUrlLen == 0, so the empty name was expected there and only the is-a-directory test missed it. hts_lastchar() from #770 is the helper for exactly that. The HTML catalog listing carries the same line and is fixed alongside, though nothing reaches it today because listRequest is never set to 1.

Closing #828 does not make PROPFIND safe. One frame below this read there is a write: proxytrack_add_DAV_Item() reserves 1024 bytes and sprintf()s into it unbounded, and escapexml() expands & to &, so a path of escaped ampersands overruns even the grown capacity. That is #836, reachable on the same unauthenticated request and strictly worse than what this fixes. Kept out of this PR on purpose.

The test replays the crash against a live proxytrack. It has to issue a second request to prove anything, since the failure mode is a dead process rather than a wrong answer. It also pins the href and the response count: displayname is derived from the href's trailing component, so on its own it cannot see a wrong path above it.

Closes #828

PT_Enumerate() reports a folder's default document as a zero-length name,
and the WebDAV listing loop read thisUrl[thisUrlLen - 1] on it, four
gigabytes past the string. One unauthenticated request took the whole
listener down.

Closes #828

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
xroche and others added 2 commits July 27, 2026 15:11
The Windows job runs *_local-*.test and compares the skip list against an
exact string, so an unpinned skip fails the leg with fail=0, which reads
like a flake. Assert the href and the response count too: displayname
alone comes from the href's trailing component, so it cannot see a wrong
path above it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
…default-doc

Signed-off-by: Xavier Roche <roche@httrack.com>

# Conflicts:
#	tests/Makefile.am
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A PROPFIND on an exact cache entry crashes proxytrack

1 participant