From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 2149C4C76B for ; Tue, 8 Jul 2025 15:10:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 0964368EA06; Tue, 8 Jul 2025 18:09:38 +0300 (EEST) Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 673D868EA03 for ; Tue, 8 Jul 2025 18:09:31 +0300 (EEST) Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-ae3b336e936so830736966b.3 for ; Tue, 08 Jul 2025 08:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751987371; x=1752592171; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=w/f841xa7N0xP4Vu8qbGbYiB169Lsk/qJOwMtbCLelw=; b=kkW+OaJAo0moA4Lmwii1sXbppuULI8vXaRn0pGi20tO/0hyLYyeJjk9ASDzfTgbAdi Z5Qh7Ej3qxoXTFJvIYNQMRxq74f4EH9Vjrjwt98Ndg1FHpsjw/fRuFYlNI1/LCLxh97j U7SjjhuUhpMcQq42h9fSuvczwylvMMxxgxsRNFKbODhaAbX/aLK2xUDWrHXlBXrWfBiO GW1XDj6dQqf2SbJ5na50JiuAz3iCCtnusYEbcvzkd0310DkU2xbCxx5KV1dFH+hMksSy cuV+CDFvznBrrX5VCxwFT5KDOnvG4rsY7z9euWRVOxEObWvXaUx03Cpm/+rhHmWSalsA bYCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751987371; x=1752592171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w/f841xa7N0xP4Vu8qbGbYiB169Lsk/qJOwMtbCLelw=; b=amUAMBi2A0sbyyVDVmE/rpNZdDsDYaZAnEHHMg1tdNsle7b0UXRAFtSjwglfSoaJTe UPm+pd9Q9gBJKp4uHOtLHsb5L+5DxiSXa7brCw9EyqDXBPW+T+gFFvbvG83eDpsVfwEn sIsV4SLejtPXqDJC+C1VB7D12c8tGmqhij8NDT3UnKQJzv10xylkgL924hkqyCg0Edgr qWZ3nO7Iv0dUtt6tKVWR3RzZJQRSPzNMN1wI3Az4xiS4rVRSdKkcWnO9xwcN4E+9jQLL qkheeyEOP5SlrI7gTRT4DPP+lUM3ltAdJklZ5bTdkE5xNa8Q8At7yMKCSmTPk5v1hzrR IZlQ== X-Gm-Message-State: AOJu0Yw/EzNK1sm+G0K6eOfDUE0VhMwA5s0bzMqura1mzXfZFDsSeqh+ YjqpvJwlVZpHz3WDNvOI/Gu09wZO+8unTIjgSSwWBJmDtATgT/oWRvnZqNSZ5lpW X-Gm-Gg: ASbGncsSkTtlyLBIGTRCr6zimCeHebW2ya2PXmbSJi0TXS+GWir7711FZLW9aOp/daW y/P8r6TYTVAHp3jrArTjfVF2kWM3+HWzpKuozXUK9rb9Np+jkl7NQknoHoK3BdkYf3oaQ+e8Bs3 CCP1+x9UbH9lE5xUbvGmCgycpw+g5MwIn5ektkkulyxZoM7glCOCy0wMzXW+J7k/lhdnQUwWh5e buGQ2KmtdL86YXF9BkSmIN467qJJEBiisYTnTYD1ur4lL64G2nPZ/NtPIJGMVxB/AV9PROmMx7x ps9vqOu+Um6UKyE+WfM43D/0G+t0SI1RZIIweGdWX6afNB2YT5UJEzwsBrVvsMksSAv7kFCQ54f df5FfLkwJPjfBFWX5K/PgiJJ1oGY86iBsT+UR7EcVz1pe1a4tUAtsEKT+nHWTqMJvPIqWTcuca6 Xfcss1Eg== X-Google-Smtp-Source: AGHT+IFLFgL6X79S4wACWU/ZXlRY+IiOG1hTS486T1xDjbDuArhF29Ia/6bqEgMwk6+K+MdS/VjgTQ== X-Received: by 2002:a17:907:86ab:b0:ae0:aed9:eba0 with SMTP id a640c23a62f3a-ae3fe790f7dmr1784964066b.55.1751987370441; Tue, 08 Jul 2025 08:09:30 -0700 (PDT) Received: from localhost.localdomain (p200301023701fa00258573ace0251429.dip0.t-ipconnect.de. [2003:102:3701:fa00:2585:73ac:e025:1429]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae3f6ac3670sm899779766b.83.2025.07.08.08.09.29 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 08 Jul 2025 08:09:30 -0700 (PDT) From: Marvin Scholz To: ffmpeg-devel@ffmpeg.org Date: Tue, 8 Jul 2025 17:09:18 +0200 Message-Id: <20250708150918.56410-3-epirat07@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250708150918.56410-1-epirat07@gmail.com> References: <20250708150918.56410-1-epirat07@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avformat/rtsp: check copy_tls_opts_dict X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Properly check av_dict_set return values and propagate them to the caller so they can be handled. --- libavformat/rtsp.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index c6203a07de..519fe29a22 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -143,18 +143,29 @@ static AVDictionary *map_to_opts(RTSPState *rt) return opts; } +#define ERR_RET(c) \ + do { \ + int ret = c; \ + if (ret < 0) \ + return ret; \ + } while (0) + /** * Add the TLS options of the given RTSPState to the dict */ -static void copy_tls_opts_dict(RTSPState *rt, AVDictionary **dict) +static int copy_tls_opts_dict(RTSPState *rt, AVDictionary **dict) { - av_dict_set_int(dict, "tls_verify", rt->tls_opts.verify, 0); - av_dict_set(dict, "ca_file", rt->tls_opts.ca_file, 0); - av_dict_set(dict, "cert_file", rt->tls_opts.cert_file, 0); - av_dict_set(dict, "key_file", rt->tls_opts.key_file, 0); - av_dict_set(dict, "verifyhost", rt->tls_opts.host, 0); + ERR_RET(av_dict_set_int(dict, "tls_verify", rt->tls_opts.verify, 0)); + ERR_RET(av_dict_set(dict, "ca_file", rt->tls_opts.ca_file, 0)); + ERR_RET(av_dict_set(dict, "cert_file", rt->tls_opts.cert_file, 0)); + ERR_RET(av_dict_set(dict, "key_file", rt->tls_opts.key_file, 0)); + ERR_RET(av_dict_set(dict, "verifyhost", rt->tls_opts.host, 0)); + + return 0; } +#undef ERR_RET + static void get_word_until_chars(char *buf, int buf_size, const char *sep, const char **pp) { @@ -1837,8 +1848,14 @@ redirect: AVDictionary *options = NULL; av_dict_set_int(&options, "timeout", rt->stimeout, 0); - if (https_tunnel) - copy_tls_opts_dict(rt, &options); + if (https_tunnel) { + int ret = copy_tls_opts_dict(rt, &options); + if (ret < 0) { + av_dict_free(&options); + err = ret; + goto fail; + } + } ff_url_join(httpname, sizeof(httpname), https_tunnel ? "https" : "http", auth, host, port, "%s", path); snprintf(sessioncookie, sizeof(sessioncookie), "%08x%08x", @@ -1924,8 +1941,14 @@ redirect: int ret; /* open the tcp connection */ AVDictionary *proto_opts = NULL; - if (strcmp("tls", lower_rtsp_proto) == 0) - copy_tls_opts_dict(rt, &proto_opts); + if (strcmp("tls", lower_rtsp_proto) == 0) { + ret = copy_tls_opts_dict(rt, &proto_opts); + if (ret < 0) { + av_dict_free(&proto_opts); + err = ret; + goto fail; + } + } ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL, host, port, -- 2.39.5 (Apple Git-154) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".