summaryrefslogtreecommitdiff
path: root/libavformat/rtsp.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-11-23 23:57:47 +0100
committerLuca Barbato <lu_zero@gentoo.org>2015-11-25 09:01:25 +0100
commit98063bcf15eb1e9bf9c8758c83c88d51cbb7ace7 (patch)
tree8c93bb4bcb502d04dd4fdc12fd53fcf62a33d7e4 /libavformat/rtsp.c
parent5b70fb8fee4af3b13f29a2dc7222fd3c9782f79b (diff)
downloadffmpeg-98063bcf15eb1e9bf9c8758c83c88d51cbb7ace7.tar.gz
rtsp: Do not assume getnameinfo cannot fail
And properly report the error when it happens.
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r--libavformat/rtsp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index f62e370ae5..8a94baf9d6 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -2264,8 +2264,14 @@ static int sdp_read_header(AVFormatContext *s)
if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) {
AVDictionary *opts = map_to_opts(rt);
- getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),
- namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
+ err = getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip,
+ sizeof(rtsp_st->sdp_ip),
+ namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
+ if (err) {
+ av_log(s, AV_LOG_ERROR, "getnameinfo: %s\n", gai_strerror(err));
+ err = AVERROR(EIO);
+ goto fail;
+ }
ff_url_join(url, sizeof(url), "rtp", NULL,
namebuf, rtsp_st->sdp_port,
"?localport=%d&ttl=%d&connect=%d&write_to_source=%d",