aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtsp.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-12-23 15:05:24 +0000
committerMartin Storsjö <martin@martin.st>2010-12-23 15:05:24 +0000
commit8c579c1c604306460436dcf1523117ca3b1aca82 (patch)
tree037ac27801de4220a2aba1b164089a59c06cd66b /libavformat/rtsp.c
parent81c8c1878085a05dddfeb95732731a1e790c0216 (diff)
downloadffmpeg-8c579c1c604306460436dcf1523117ca3b1aca82.tar.gz
rtsp: Require the transport reply from the server to match the request
This fixes a crash if we requested TCP interleaved transport, but the server replies with transport data for UDP. According to the RFC, the server isn't allowed to respond with another transport type than the one requested. Originally committed as revision 26077 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r--libavformat/rtsp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 2703400720..48ed6b5d46 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1111,11 +1111,12 @@ static int make_setup_request(AVFormatContext *s, const char *host, int port,
rt->transport = reply->transports[0].transport;
}
- /* close RTP connection if not chosen */
- if (reply->transports[0].lower_transport != RTSP_LOWER_TRANSPORT_UDP &&
- (lower_transport == RTSP_LOWER_TRANSPORT_UDP)) {
- url_close(rtsp_st->rtp_handle);
- rtsp_st->rtp_handle = NULL;
+ /* Fail if the server responded with another lower transport mode
+ * than what we requested. */
+ if (reply->transports[0].lower_transport != lower_transport) {
+ av_log(s, AV_LOG_ERROR, "Nonmatching transport in server reply\n");
+ err = AVERROR_INVALIDDATA;
+ goto fail;
}
switch(reply->transports[0].lower_transport) {