From patchwork Sun Feb 18 12:46:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Schramm X-Patchwork-Id: 874863 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: 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=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TFk9/oSa"; 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 3zkms140yJz9sWh for ; Sun, 18 Feb 2018 23:48:37 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 2B915B91487; Sun, 18 Feb 2018 13:47:13 +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:47:13 +0100 (CET) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 381F2B912C2 for ; Sun, 18 Feb 2018 13:46:52 +0100 (CET) X-policyd-weight: using cached result; rate: -7 Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sun, 18 Feb 2018 13:46:52 +0100 (CET) Received: by mail-lf0-f66.google.com with SMTP id t204so6978648lff.9 for ; Sun, 18 Feb 2018 04:46:52 -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=nD75dpC1yCPmGEd13arUaQojukBbcs2aR9FgtvedKWo=; b=TFk9/oSas5wI/daZk+Corg90pI/rZ50tpdweXkgJRtTpCbtakCPH6BgfxKtwrpZrhI fueM4ZPgNNX2C7sLdnN0Drj8jNFZdg2aZLIceSzMKslxQh/3d9kvSW33Fm1yh+9sRu/2 WDnkwWkKJmFgp2E5V0egKwbCqLQ3/D7XhBPGQ2sZ+VeRW2WuBMyb1gXaIqXrTM78z3rW 77bJdI++CHJKugI5Lu8CrHbuSwaL5vp0M4/h9ymAKZUEZmSStcFcf6IX33JsPPCxlCU6 qShQIuPFDQl05MDQwmU4E052zPrw5ZrvwmRXZRg38sFtIxyaaEP0lnPVF2INtyZvgqn6 Wj4g== 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=nD75dpC1yCPmGEd13arUaQojukBbcs2aR9FgtvedKWo=; b=CsorY8S2TPy4vXTLIltoMDhOOszxapCBt3xc4eFsXGwZRhH2EZbO/mE78kvYo8nXgl sRiwHWMITiMDscw4DUz9+0RUaJ9DEDhTSjJF5jEJLCV+c3gZkYkEjzdWl2YkGvP7SxvI /12VM0wT/qj2HMYPblzpqP2SZ6ywPUJKiwkazWaIahy+BU7Yzi1GG5OnEMCEMh3+DeIT pZY7RlKgMyj58vEZafjkMVHgNMwaisJB1s8CUZz76mlO2FmtlAD2oLkX6qUKfdgfzjHi M/uwHjL6ECNa37J5u/jX4rUu13CmBCdURgQINRCjfw7MpY9CorcoDTI6naumFADzXP3i 5zdA== X-Gm-Message-State: APf1xPDhIanLUvxjdkPOHZDbOnc7nHatF7bAemUKvsUZPdAVIYNYmzh8 UNDyrt2GclIWpb0+/GCCQLGkRyZU X-Google-Smtp-Source: AH8x226eIUZifdLFBSf5XCMPgzfqvMTzeA4EwUnW8ImZ0GqISECdya7nCp/yBOfN7ic1dWNSgvxzSA== X-Received: by 10.46.21.75 with SMTP id 11mr4677503ljv.58.1518958011336; Sun, 18 Feb 2018 04:46:51 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Feb 2018 04:46:50 -0800 (PST) From: Tobias Schramm To: openwrt-devel@lists.openwrt.org Date: Sun, 18 Feb 2018 13:46:10 +0100 Message-Id: <20180218124610.32692-8-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 7/7] uclient: Handle memory allocation failure for url X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Check ptr to url after allocation to prevent null pointer dereference Signed-off-by: Tobias Schramm --- uclient.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/uclient.c b/uclient.c index 8862b55..1137168 100644 --- a/uclient.c +++ b/uclient.c @@ -59,6 +59,9 @@ __uclient_get_url(const struct uclient_backend *backend, &uri_buf, strlen(location) + 1, &auth_buf, auth_str ? strlen(auth_str) + 1 : 0); + if (!url) + return NULL; + url->backend = backend; url->location = strcpy(uri_buf, location); if (host)