From patchwork Sun Apr 19 19:31:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1273000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::337; helo=mail-wm1-x337.google.com; envelope-from=swupdate+bncbcxploxj6ikrbaoo6l2akgqempv6u4a@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=i9UnPySU; dkim-atps=neutral Received: from mail-wm1-x337.google.com (mail-wm1-x337.google.com [IPv6:2a00:1450:4864:20::337]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4950Lb2gflz9sR4 for ; Mon, 20 Apr 2020 05:31:17 +1000 (AEST) Received: by mail-wm1-x337.google.com with SMTP id t62sf3187653wma.0 for ; Sun, 19 Apr 2020 12:31:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1587324673; cv=pass; d=google.com; s=arc-20160816; b=OZjtmBu7xt6EC7Pm2mZ6Es05bLp2j38g3pbejpKCDvwddVq/gqXLTUTFagy5uhqucr MmDmGSD9rLI9m+52G8l1b2NewtSdnHErpcv9HKL+WmIuw+ebUPdQmIu7DC88YN2MVQuF WPT7AdoBIdmngTmSy1y/iwVkHzPwYX4hRZf1u+Pg4TQLLgR0oyM/NXHxdg1T7t+fy2oW nl8cVTkdXlU4RHBqB9P+dhmm2RQ+zWgx9ZxOhPae0ZxdGDIdSecyFzZS8nT4y3LhyFVt iogF2yJNy8nznKUC0671jg1h3SUMddlbY3WC6Fk/aZV1QO1e5Z8UMsjMhnMp9l2+1KUo rtGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=kascQMwKZuuBwCnDTVg+hK3N1um22zJX1KQWl+pTWmY=; b=SsaaABOrILRDKoedUdtryAypmMBUAO/b1twuPa1T/AcPLP2MX14KBiZLJOBsQWSGDz plcGOUWHuG+hWkIDnz+uKEJqpXFB/x/3ONldv9TJuX9I7E60WL4RhDDUbztYYpi5M7+5 K4Od498E0VW0EAO4Zm9bmzjyiyYWvxbNJmjKbVjAJkNllRkMzKlw5VWOENRVJi8NjB+o G4WFQDU0WRaaVmkbpVy/NEeRA8VGiM/MTEhmJNn6l+TJYFbWWTsMOPnz0P20UAkdNZ97 Qs6QFHrUDQKQ/AAYeBzj5p35rlEM31V0pXZPCj8N+zrE6ytsW51x4/EjsRCXgevdnikQ 4Eog== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=kascQMwKZuuBwCnDTVg+hK3N1um22zJX1KQWl+pTWmY=; b=i9UnPySUYzIM+pzQmj/GQ371pQO+H3zgqKFWkkr/xFxuqWfI+W+Cj4ScOKh9f4y+vg MVXncQXrgWKL4u219a5Qt/X+9qmSrxm007l+KFzXD7I+eFWxMKx2/3/9NsDnwVKPtZsd ww2C+DTieT9PbiJ+rWKpjmWjGgiBYOFr3jS2f/2i1Sid4sjtM3Egy9qFS9xiqG56yfEs 5GOxd2gnC6E6MYcUCsigaYw88SO9pCeR9F+5J0m6nYHIJppHj6UqPvljb+aNNA0petFK 8tStkuGsg+ZGF+arO1CsH2dL8Z32g3Q26a4cpugsTWPUlddv5Jfs7kkAK6DkvHi3JZzZ j9pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=kascQMwKZuuBwCnDTVg+hK3N1um22zJX1KQWl+pTWmY=; b=RRsxjvoaXWwTMhY0xLJ5aiZvbI+OJsZXHphqxvms5UcCirlC8iPQHpblyrbSXrn8yu 0mHRYuI4Nlt4L0ygFzw/Pt0tnrzw8RuTJKQMeJpny7SmEINaM6rmeZbVst0CVrdCoOCM doQAd3nprZ99Ia3gWiZ3ZsDNwBNuINxkLOiEJh6KvLod15e5Je7Ua1247L5PhRHSR3VD 0eSvPvAh7Lw1D/Tg8ibNhR/HxATVdfJpC9M+4ISTOtSpJ8WvRCzFM8D9aIk1Wz/AxtLm QqDY4/Ph7El/rnLNrrHiytQIOd6ErazRvdgs04NAqqL+wmXlanrIPkya8niUvb57FHPI eOXw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AGi0Pua24p9wr+9j8WluG4T7Vxxo7n6RgSjFrah0UscjlHHUR433eSha E9oUMynwwYIVUZGVUqx8Pik= X-Google-Smtp-Source: APiQypKwZ4yo1EPIivOc6rI8+psU8hO+ewELAL20Kn9Zq1HL06RPxovcswJQ6j0eFWB6nwwcJ2L3KQ== X-Received: by 2002:a05:600c:21d6:: with SMTP id x22mr14571633wmj.95.1587324673587; Sun, 19 Apr 2020 12:31:13 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a1c:4088:: with SMTP id n130ls11674007wma.2.canary-gmail; Sun, 19 Apr 2020 12:31:12 -0700 (PDT) X-Received: by 2002:a05:600c:2112:: with SMTP id u18mr14460026wml.112.1587324672709; Sun, 19 Apr 2020 12:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587324672; cv=none; d=google.com; s=arc-20160816; b=nqdhjieOeSXoHmZd96i2lqTPGnKcQ/d/K9GMJdbUgSqBAqTiisFJwOBCpK6hoCXzIw er3Dahc0A6CoSOcp+B3PJ4iL/0BrE7L9kJRVVv/uDPe48bEDcvPqBNWofoEuMtjZ2VAr Zv84HC1huP8ls8If89JEB8xgy+oFX9EfT+et9LY51R9XQEA9MtRGN7b2O2360Q9m3zSQ b1E4QCG9vVxdnTXkHDuSYI8TyqN5WyY7/k7oyJ+4SdkU6oCpoBQb+WQWKxmvnW1O+rSM S2Mu8F+fuOXszSwV2PF1ioF+qRa5FwLwuuawp+DvG0+H5joJMcCLNSCpxqVZHC8hnkpE adjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=WcYNjRHQ3WHRdXyVAW7doXA8ee664+iYfABN9sqgmDI=; b=rKxbHlfJX2APUMjGSfmPUMU99r/nWphygi5wY2PKP4mbuwkYaDJ+EbOp+AHk978rMN LJZG7RTOlKRHC9eN4PyEPhx12u3dl6RTqAV/hEECEhK7M2BeZ2Ofi45VzqRAIaJFH1BB CF04HkwrmRgjNEFivWx4QL7IU4M+hMMdKX+KZFK2RURE6NOyeDAaYdJ9ZPRmJ70upmGo Cn19542OBmO7ehHhdvJXE47vpk54lztYKCIQk//iWTCrmiIFZ4fj1nGDtDkAyld13bWD r7ldlTOCSCRkjwY/riokPHjm3IM1fmbvfE+omcFzuLn9RIhLZA3XY/5Y5jkEjtZXl++R izQg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id x11si737434wmi.1.2020.04.19.12.31.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Apr 2020 12:31:12 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4950LS3p1zz1qrLx; Sun, 19 Apr 2020 21:31:12 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4950LS3cnZz1qr51; Sun, 19 Apr 2020 21:31:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 5qcfC75GSztJ; Sun, 19 Apr 2020 21:31:11 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Sun, 19 Apr 2020 21:31:11 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 73E9A45403C1; Sun, 19 Apr 2020 21:31:11 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([IPv6:::1]) by localhost (mail.babic.homelinux.org [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id twWjek0Z9RYY; Sun, 19 Apr 2020 21:31:09 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.38]) by babic.homelinux.org (Postfix) with ESMTP id 9DC514540578; Sun, 19 Apr 2020 21:31:06 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] Fix coverity #292113 Date: Sun, 19 Apr 2020 21:31:00 +0200 Message-Id: <20200419193104.22351-3-sbabic@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200419193104.22351-1-sbabic@denx.de> References: <20200419193104.22351-1-sbabic@denx.de> MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Signed-off-by: Stefano Babic --- core/stream_interface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/stream_interface.c b/core/stream_interface.c index f9a71b5..bf502e5 100644 --- a/core/stream_interface.c +++ b/core/stream_interface.c @@ -360,6 +360,9 @@ static int save_stream(int fdin, struct swupdate_cfg *software) char output_file[MAX_IMAGE_FNAME]; const char* TMPDIR = get_tmpdir(); + if (fdin < 0) + return -EINVAL; + snprintf(tmpfilename, sizeof(tmpfilename), "%s/%s", TMPDIR, SW_TMP_OUTPUT); buf = (unsigned char *)malloc(bufsize);