Message ID | 20180218124610.32692-2-tobleminer@gmail.com |
---|---|
State | Accepted |
Delegated to: | John Crispin |
Headers | show
Return-Path: <openwrt-devel-bounces@lists.openwrt.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (helo) smtp.helo=arrakis.dune.hu (client-ip=78.24.191.176; helo=arrakis.dune.hu; envelope-from=openwrt-devel-bounces@lists.openwrt.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="c22wY4BA"; dkim-atps=neutral Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zkmqK4hqXz9sWg for <incoming@patchwork.ozlabs.org>; Sun, 18 Feb 2018 23:47:09 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 1A958B91291; Sun, 18 Feb 2018 13:46:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Sun, 18 Feb 2018 13:46:49 +0100 (CET) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 97137B911E4 for <openwrt-devel@lists.openwrt.org>; Sun, 18 Feb 2018 13:46:44 +0100 (CET) X-policyd-weight: using cached result; rate: -7 Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by arrakis.dune.hu (Postfix) with ESMTPS for <openwrt-devel@lists.openwrt.org>; Sun, 18 Feb 2018 13:46:44 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id l191so9636315lfe.1 for <openwrt-devel@lists.openwrt.org>; Sun, 18 Feb 2018 04:46:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AuTuAt0+o1CpOa6J56fcEWYYJoRhKmvRior2cPIcPNg=; b=c22wY4BA79KEF+5mIDhuRn2UsV2NGPK4AZFgvYtoOf92zu+WA0ZDXolUVv7+uV/k/w NYJY2PH4zdYGdxuimOEOFnLkr2YNCrPJpwLWPN9YqsTEspPiRCoEH9U7VWfd3PNUDrcW Gd9rwS80dhoh4IDBcW+dzBm/W/aRst6ftgDxcMwOJc4aG8ZNxl85ZXjH3GK5UMXoFoDr eBfBH5tWjcGJXDJH4/JXV0V2StYWOqCGUrp7a5BnznT8r64PMxMVcZvNZqMgYqvOU8Hv yxCtHIhOs/pGmInJEm+fnMblrlkIWTLsffPs7AdyzwbmGjYLctyZcP0HRjSYJoY9HtHD A6Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AuTuAt0+o1CpOa6J56fcEWYYJoRhKmvRior2cPIcPNg=; b=feAgE16l4FJIHqJXseXhpj0j6FB9gubxwavdSyF6PVTq3ibibCubfQ8C5wlDT8JvGl MdDp+ofekGtWEkxENYIRkitWORVpEZlvT561Jm04pF4GN/DO8zdG3tmZHR+gnS5jx/wq R253uJ/ivj11idhvHn5Vx66ll3nldO4j3vRrShdXJvhCIJoXaeauFpzyZonZDibYg1vU BBvYx4CK6B5IMoqCgZo2V4wP4/scNSkqKjiMdf1KBDoi28Mb6XiVwrFzqVeshHSgM+jR Dh7A7AoL8eaZPrUqFlvpkZktlSGFC+b/o96UdfqGnYh+o15ZzyorCpnnU7nrwyBMElP4 tqgw== X-Gm-Message-State: APf1xPCHkJEb30KeI1fxMy1bvfomUZ2O7AmG14UKgF6p7kpaIHDA6+w3 OMJEPYMBA6v6/neKiDxeXxtrSax7 X-Google-Smtp-Source: AH8x227dwRpktULYqLhd/yE3iT1JiAHYApz/MZGeWuye16pXb0RZRZCDcIxAAppUqTMgeWDiaG+jQA== X-Received: by 10.25.233.154 with SMTP id j26mr8138039lfk.30.1518958003575; Sun, 18 Feb 2018 04:46:43 -0800 (PST) Received: from sunsetshimmer.lan ([2a02:8108:17c0:1500:f666:aee7:edff:2dfc]) by smtp.gmail.com with ESMTPSA id s1sm3176923ljd.13.2018.02.18.04.46.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Feb 2018 04:46:43 -0800 (PST) From: Tobias Schramm <tobleminer@gmail.com> To: openwrt-devel@lists.openwrt.org Date: Sun, 18 Feb 2018 13:46:04 +0100 Message-Id: <20180218124610.32692-2-tobleminer@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180218124610.32692-1-tobleminer@gmail.com> References: <20180218124610.32692-1-tobleminer@gmail.com> Subject: [OpenWrt-Devel] [PATCH v2 1/7] uclient-fetch: Check for nullpointer returned by uclient_get_url_filename X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List <openwrt-devel.lists.openwrt.org> List-Unsubscribe: <https://lists.openwrt.org/cgi-bin/mailman/options/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe> List-Archive: <http://lists.openwrt.org/pipermail/openwrt-devel/> List-Post: <mailto:openwrt-devel@lists.openwrt.org> List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help> List-Subscribe: <https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org> |
Series |
uclient: Handle memory allocation failures
|
expand
|
diff --git a/uclient-fetch.c b/uclient-fetch.c index 6961d94..38c9c53 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -122,6 +122,11 @@ static int open_output_file(const char *path, uint64_t resume_offset) } } else { filename = uclient_get_url_filename(path, "index.html"); + if (!filename) { + ret = -ENOMEM; + goto out; + } + output_file = filename; } @@ -151,6 +156,7 @@ done: free: free(filename); +out: return ret; }
uclient_get_url_filename may return a null ptr resulting in a null ptr dereference by fprintf and open Signed-off-by: Tobias Schramm <tobleminer@gmail.com> --- uclient-fetch.c | 6 ++++++ 1 file changed, 6 insertions(+)