diff mbox

[FFmpeg-devel,04/11] avformat/librtmp: check return value of setsockopt

Message ID 20170611140551.11844-4-timo@rothenpieler.org
State Accepted
Commit 4b2a2969f3e06433a06f835d2af2bae4499314ae
Headers show

Commit Message

Timo Rothenpieler June 11, 2017, 2:05 p.m. UTC
Fixes CID 1396837
---
 libavformat/librtmp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Steven Liu June 12, 2017, 3:07 a.m. UTC | #1
2017-06-11 22:05 GMT+08:00 Timo Rothenpieler <timo@rothenpieler.org>:
> Fixes CID 1396837
> ---
>  libavformat/librtmp.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
> index 146df660ac..f3cfa9a8e2 100644
> --- a/libavformat/librtmp.c
> +++ b/libavformat/librtmp.c
> @@ -239,7 +239,10 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
>  #if CONFIG_NETWORK
>      if (ctx->buffer_size >= 0 && (flags & AVIO_FLAG_WRITE)) {
>          int tmp = ctx->buffer_size;
> -        setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp));
> +        if (setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp))) {
> +            rc = AVERROR_EXTERNAL;
> +            goto fail;
> +        }
>      }
>  #endif
LGTM

>
> --
> 2.13.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Timo Rothenpieler June 13, 2017, 5:53 p.m. UTC | #2
Am 12.06.2017 um 05:07 schrieb Steven Liu:
> 2017-06-11 22:05 GMT+08:00 Timo Rothenpieler <timo@rothenpieler.org>:
>> Fixes CID 1396837
>> ---
>>   libavformat/librtmp.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
>> index 146df660ac..f3cfa9a8e2 100644
>> --- a/libavformat/librtmp.c
>> +++ b/libavformat/librtmp.c
>> @@ -239,7 +239,10 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
>>   #if CONFIG_NETWORK
>>       if (ctx->buffer_size >= 0 && (flags & AVIO_FLAG_WRITE)) {
>>           int tmp = ctx->buffer_size;
>> -        setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp));
>> +        if (setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp))) {
>> +            rc = AVERROR_EXTERNAL;
>> +            goto fail;
>> +        }
>>       }
>>   #endif
> LGTM
> 
applied
diff mbox

Patch

diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
index 146df660ac..f3cfa9a8e2 100644
--- a/libavformat/librtmp.c
+++ b/libavformat/librtmp.c
@@ -239,7 +239,10 @@  static int rtmp_open(URLContext *s, const char *uri, int flags)
 #if CONFIG_NETWORK
     if (ctx->buffer_size >= 0 && (flags & AVIO_FLAG_WRITE)) {
         int tmp = ctx->buffer_size;
-        setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp));
+        if (setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp))) {
+            rc = AVERROR_EXTERNAL;
+            goto fail;
+        }
     }
 #endif