Showing the changes to libavformat (1 of 1 file). Show all
Unified · Split
| @@ -30,15 +30,18 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "libavutil/opt.h" |
| 31 | 31 | #include "libavutil/parseutils.h" |
| 32 | 32 | |
| 33 | −static void set_options(TLSShared *c, const char *uri) | |
| 33 | +static int set_options(TLSShared *c, const char *uri) | |
| 34 | 34 | { |
| 35 | 35 | char buf[1024]; |
| 36 | 36 | const char *p = strchr(uri, '?'); |
| 37 | 37 | if (!p) |
| 38 | − return; | |
| 38 | + return 0; | |
| 39 | 39 | |
| 40 | − if (!c->ca_file && av_find_info_tag(buf, sizeof(buf), "cafile", p)) | |
| 40 | + if (!c->ca_file && av_find_info_tag(buf, sizeof(buf), "cafile", p)) { | |
| 41 | 41 | c->ca_file = av_strdup(buf); |
| 42 | + if (!c->ca_file) | |
| 43 | + return AVERROR(ENOMEM); | |
| 44 | + } | |
| 42 | 45 | |
| 43 | 46 | if (!c->verify && av_find_info_tag(buf, sizeof(buf), "verify", p)) { |
| 44 | 47 | char *endptr = NULL; |
| @@ -47,11 +50,19 @@ static void set_options(TLSShared *c, const char *uri) · 2 unmodified lines | ||
| 47 | 50 | c->verify = 1; |
| 48 | 51 | } |
| 49 | 52 | |
| 50 | − if (!c->cert_file && av_find_info_tag(buf, sizeof(buf), "cert", p)) | |
| 53 | + if (!c->cert_file && av_find_info_tag(buf, sizeof(buf), "cert", p)) { | |
| 51 | 54 | c->cert_file = av_strdup(buf); |
| 55 | + if (!c->cert_file) | |
| 56 | + return AVERROR(ENOMEM); | |
| 57 | + } | |
| 52 | 58 | |
| 53 | − if (!c->key_file && av_find_info_tag(buf, sizeof(buf), "key", p)) | |
| 59 | + if (!c->key_file && av_find_info_tag(buf, sizeof(buf), "key", p)) { | |
| 54 | 60 | c->key_file = av_strdup(buf); |
| 61 | + if (!c->key_file) | |
| 62 | + return AVERROR(ENOMEM); | |
| 63 | + } | |
| 64 | + | |
| 65 | + return 0; | |
| 55 | 66 | } |
| 56 | 67 | |
| 57 | 68 | int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AVDictionary **options) |
| @@ -63,8 +74,11 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV · 5 unmodified lines | ||
| 63 | 74 | const char *proxy_path; |
| 64 | 75 | char *env_http_proxy, *env_no_proxy; |
| 65 | 76 | int use_proxy; |
| 77 | + int ret; | |
| 66 | 78 | |
| 67 | − set_options(c, uri); | |
| 79 | + ret = set_options(c, uri); | |
| 80 | + if (ret < 0) | |
| 81 | + return ret; | |
| 68 | 82 | |
| 69 | 83 | if (c->listen) |
| 70 | 84 | snprintf(opts, sizeof(opts), "?listen=1"); |