mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
check content_type exists (to avoid DOS risk, thanks @0pepsi)
This commit is contained in:
@@ -198,8 +198,9 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response) {
|
||||
*/
|
||||
|
||||
const char *method = http_request_get_method(request);
|
||||
const char *url = http_request_get_url(request);
|
||||
|
||||
if (!method) {
|
||||
if (!method || !url) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -211,7 +212,6 @@ conn_request(void *ptr, http_request_t *request, http_response_t **response) {
|
||||
return;
|
||||
}
|
||||
|
||||
const char *url = http_request_get_url(request);
|
||||
const char *client_session_id = http_request_get_header(request, "X-Apple-Session-ID");
|
||||
const char *host = http_request_get_header(request, "Host");
|
||||
hls_request = (host && !cseq && !client_session_id);
|
||||
|
||||
@@ -1012,6 +1012,11 @@ raop_handler_get_parameter(raop_conn_t *conn,
|
||||
int datalen;
|
||||
|
||||
content_type = http_request_get_header(request, "Content-Type");
|
||||
if (!content_type) {
|
||||
http_response_init(response, "RTSP/1.0", 451, "Parameter not understood");
|
||||
return;
|
||||
}
|
||||
|
||||
data = http_request_get_data(request, &datalen);
|
||||
if (!strcmp(content_type, "text/parameters")) {
|
||||
const char *current = data;
|
||||
@@ -1060,6 +1065,10 @@ raop_handler_set_parameter(raop_conn_t *conn,
|
||||
int datalen;
|
||||
|
||||
content_type = http_request_get_header(request, "Content-Type");
|
||||
if (!content_type) {
|
||||
http_response_init(response, "RTSP/1.0", 451, "Parameter not understood");
|
||||
return;
|
||||
}
|
||||
data = http_request_get_data(request, &datalen);
|
||||
if (!strcmp(content_type, "text/parameters")) {
|
||||
char *datastr;
|
||||
|
||||
Reference in New Issue
Block a user