mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
rtsp: Segfault in rtsp.c when using WRITEDATA
If the INTERLEAVEFUNCTION is defined, then use that plus the INTERLEAVEDATA information when writing RTP. Otherwise, use WRITEFUNCTION and WRITEDATA. Fixes #1880 Closes #1884
This commit is contained in:
parent
9bba664e02
commit
08dbed31d5
23
lib/rtsp.c
23
lib/rtsp.c
@ -749,23 +749,28 @@ CURLcode rtp_client_write(struct connectdata *conn, char *ptr, size_t len)
|
|||||||
struct Curl_easy *data = conn->data;
|
struct Curl_easy *data = conn->data;
|
||||||
size_t wrote;
|
size_t wrote;
|
||||||
curl_write_callback writeit;
|
curl_write_callback writeit;
|
||||||
|
void *user_ptr;
|
||||||
|
|
||||||
if(len == 0) {
|
if(len == 0) {
|
||||||
failf(data, "Cannot write a 0 size RTP packet.");
|
failf(data, "Cannot write a 0 size RTP packet.");
|
||||||
return CURLE_WRITE_ERROR;
|
return CURLE_WRITE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeit = data->set.fwrite_rtp?data->set.fwrite_rtp:data->set.fwrite_func;
|
/* If the user has configured CURLOPT_INTERLEAVEFUNCTION then use that
|
||||||
|
function and any configured CURLOPT_INTERLEAVEDATA to write out the RTP
|
||||||
if(!data->set.fwrite_rtp && !data->set.is_fwrite_set &&
|
data. Otherwise, use the CURLOPT_WRITEFUNCTION with the CURLOPT_WRITEDATA
|
||||||
!data->set.rtp_out) {
|
pointer to write out the RTP data. */
|
||||||
/* if no callback is set for either RTP or default, the default function
|
if(data->set.fwrite_rtp) {
|
||||||
fwrite() is utilized and that can't handle a NULL input */
|
writeit = data->set.fwrite_rtp;
|
||||||
failf(data, "No destination to default data callback!");
|
user_ptr = data->set.rtp_out;
|
||||||
return CURLE_WRITE_ERROR;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writeit = data->set.fwrite_func;
|
||||||
|
user_ptr = data->set.out;
|
||||||
}
|
}
|
||||||
|
|
||||||
wrote = writeit(ptr, 1, len, data->set.rtp_out);
|
wrote = writeit(ptr, 1, len, user_ptr);
|
||||||
|
|
||||||
if(CURL_WRITEFUNC_PAUSE == wrote) {
|
if(CURL_WRITEFUNC_PAUSE == wrote) {
|
||||||
failf(data, "Cannot pause RTP");
|
failf(data, "Cannot pause RTP");
|
||||||
|
Loading…
Reference in New Issue
Block a user