Skip to content

upnp: defer cleanup for HTTP status errors - #2577

Open
acts-1631 wants to merge 1 commit into
MusicPlayerDaemon:v0.24.xfrom
acts-1631:fix/upnp-http-error-lifetime
Open

upnp: defer cleanup for HTTP status errors#2577
acts-1631 wants to merge 1 commit into
MusicPlayerDaemon:v0.24.xfrom
acts-1631:fix/upnp-http-error-lifetime

Conversation

@acts-1631

Copy link
Copy Markdown
Contributor

The UPnP device description downloader deleted itself from OnHeaders() when a server returned a non-200 status. CurlResponseHandlerAdapter then continued DataReceived() and called OnData() through the deleted request, causing a use-after-free. A UPnP server on the local network can trigger this when the UPnP database or neighbor plugin is enabled.

Throw HttpStatusError instead. The curl adapter records the exception, aborts the transfer, and invokes OnError() after leaving the data callback, where the downloader can be destroyed safely.

Deleting the device description downloader from OnHeaders() frees the
CurlResponseHandlerAdapter while DataReceived() still uses it. A UPnP
server can trigger a use-after-free by returning a non-200 response with
body data.

Throw HttpStatusError so the adapter defers cleanup until OnError().
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.

1 participant