From patchwork Wed Feb 13 08:25:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 220078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D50552C0091 for ; Wed, 13 Feb 2013 19:25:56 +1100 (EST) Received: from localhost ([::1]:59952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5Xf8-0002VD-US for incoming@patchwork.ozlabs.org; Wed, 13 Feb 2013 03:25:54 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5Xey-0002Tl-TI for qemu-devel@nongnu.org; Wed, 13 Feb 2013 03:25:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5Xev-0004kD-90 for qemu-devel@nongnu.org; Wed, 13 Feb 2013 03:25:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5Xev-0004jz-1F for qemu-devel@nongnu.org; Wed, 13 Feb 2013 03:25:41 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1D8PeGT032486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Feb 2013 03:25:40 -0500 Received: from localhost (ovpn-112-21.ams2.redhat.com [10.36.112.21]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1D8PdZG006108; Wed, 13 Feb 2013 03:25:39 -0500 From: Stefan Hajnoczi To: Date: Wed, 13 Feb 2013 09:25:34 +0100 Message-Id: <1360743934-8337-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r1D8PeGT032486 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Andreas Faerber , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH for-1.4] block/curl: only restrict protocols with libcurl>=7.19.4 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, ...) interface was introduced in libcurl 7.19.4. Therefore we cannot protect against CVE-2013-0249 when linking against an older libcurl. This fixes the build failure introduced by fb6d1bbd246c7a57ef53d3847ef225cd1349d602. Reported-by: Andreas Färber Signed-off-by: Stefan Hajnoczi Tested-by: Andreas Färber --- block/curl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/curl.c b/block/curl.c index f6226b3..98947da 100644 --- a/block/curl.c +++ b/block/curl.c @@ -309,9 +309,13 @@ static CURLState *curl_init_state(BDRVCURLState *s) /* Restrict supported protocols to avoid security issues in the more * obscure protocols. For example, do not allow POP3/SMTP/IMAP see * CVE-2013-0249. + * + * Restricting protocols is only supported from 7.19.4 upwards. */ +#if LIBCURL_VERSION_NUM >= 0x071304 curl_easy_setopt(state->curl, CURLOPT_PROTOCOLS, PROTOCOLS); curl_easy_setopt(state->curl, CURLOPT_REDIR_PROTOCOLS, PROTOCOLS); +#endif #ifdef DEBUG_VERBOSE curl_easy_setopt(state->curl, CURLOPT_VERBOSE, 1);