From patchwork Sun Apr 19 19:31:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1273004 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::53b; helo=mail-ed1-x53b.google.com; envelope-from=swupdate+bncbcxploxj6ikrbawo6l2akgqe4em2l6a@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=AdQx/Lxk; dkim-atps=neutral Received: from mail-ed1-x53b.google.com (mail-ed1-x53b.google.com [IPv6:2a00:1450:4864:20::53b]) (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 4950Lb2Pv0z9s71 for ; Mon, 20 Apr 2020 05:31:17 +1000 (AEST) Received: by mail-ed1-x53b.google.com with SMTP id f11sf2638855edc.4 for ; Sun, 19 Apr 2020 12:31:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1587324674; cv=pass; d=google.com; s=arc-20160816; b=JNoLAmf0Ipy+9BVZl5AEVGLbv1vpL1dVQcFFRAAX/MTIzNgywcMbadE+QMh9XE03FC WCV0VObfwaYj0nneSWdKtVKC3xdEnn463wtXUWurKmMg1naE2qbYGcINE7BKZr7Yx5/h Bc+d9S+RUU3cCJNCpMGSjJYMX3OLAZMnYqKU0kPLBEbzov+6ipiPaQf8gejHVCxdAgmE 5TEHI+M+sKvRtauO2NzjafljFtmQFhJfqU7qgwbvDeSOY3c4rUgr9gw7l9mBWhLfpPvZ 7eo2P1WE4sJDa2/i1X0DyYOAzjsylZa7qmzaIFNDbHgxX9Cy9iwDqfnbth+AYyvU8eXN rgBQ== 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=LwSwZ0Bs/55ghT4XeRTJEbPPNsygj0bMELqaXtuTl4k=; b=pypQTt3N1OWYmR9uNZHpFdO2jK4w5LSYfQUzpsHpTaP79MKQpAlNpvucudD5GhMmve irRPJrXtWRGpb9/rYV6qE3uT2/jEiwJEejLNipRFbGoGG8E2fsm7H7QYlFEIzEMot6DM 7CRLYuxNlW5LWgbSj+JeKxygw9XIi6qyFTIQdHR41cgZvDlnyC7IgEDCAnRVygQijmHe 1aOd+Fv/gzkZrX18GiPwTbxNETcEGpSITUE3KxKunJgW56/lxMnQ9Mn17rpoZ/YI6ESE YmtOJxNulwzhEfNedn1Vc/sQheVgFI5hX8Tt6hrk13qFGMlZh77eW1sz3L20cR7X+Ee8 WkWA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 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=LwSwZ0Bs/55ghT4XeRTJEbPPNsygj0bMELqaXtuTl4k=; b=AdQx/LxkSSiBlG4zkgwmcCW1TFsBnebL14k1FjGWoTHafdlIi5XCMlK/w3z0SMSv67 QkI8ndYvz3vjLIV0MURmYQ0wxjmQrKYkI4bRyohkbsYA7kRifhDGEWBbZm6MZ6J039mO Y8uCVGSg+jM5J0kPjRA0ACVJiJYFYLZacXI30vFEueRHQuA6xTxfZtz5ELLkIl5hphVM wqSAxvQbBCf7jW0qj1qoZvjwULFQxLzLz6idPyH6RcRsvYR5AE1Glz8COuKlcGBBCCiz vhSvqIPLLNKRSiEHNGoCr11lwZX3y5DJ0eljYlRiZlkFNmPZPJOsqeoUQGzew1/+5TfK GT8A== 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=LwSwZ0Bs/55ghT4XeRTJEbPPNsygj0bMELqaXtuTl4k=; b=mV/q+VKIiPRpKg3PvX/JT43MpiufDI/hSq4Y93OuVNkjze5PX8Jz76jtpNHhyvPDcq xSEGkUCISkVE4CR6CFng13OGZmandIxKfgncXWYw9UJ8CLzzjJjqsv/YvFoyc1T+MgPe Zmt5iqP70xyoJZG1gdprwOsD+jGOzxVYcU9yVk/8uB8IQ4q2YpX3Zpa1JP2SQx8oFtGR Ic93MRutUCt1YkpCI7ZPNdc3X2W2d2zsjPVGr7U6tHqHiZkhuJTJSPH02Eypm9X3gisK DX3EDynQOwyoieqDJ60YxceGzJlZdT/cjJGKG9rcglMEiMUWNvQ7sXG86zUqBWYFoQlU cTKA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AGi0PuY/nGy2RNBWHCoQid5jn5pTQDewxSqmjZAhjXfzXgkR/tnsBCX1 Xk8lLGm6uHme2MP/eqJPzv4= X-Google-Smtp-Source: APiQypJW7dfhl+BmMaie4vG9+34/lr8lbK1w534OoZca7I6yi3dXFQEjGq8gXBE92Vyq/5mbK36MrA== X-Received: by 2002:a17:906:85d3:: with SMTP id i19mr12468506ejy.153.1587324674462; Sun, 19 Apr 2020 12:31:14 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a50:eb0d:: with SMTP id y13ls6690599edp.9.gmail; Sun, 19 Apr 2020 12:31:13 -0700 (PDT) X-Received: by 2002:aa7:c1ca:: with SMTP id d10mr11733575edp.152.1587324673687; Sun, 19 Apr 2020 12:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587324673; cv=none; d=google.com; s=arc-20160816; b=nbEYC6LBnZw0cqZFMI/oeQ4az4+1r2S4TutL6n4LSAuWRjbGGxPyoyDzjyICSUimfx SN0eDSXxD/V2mm+AFsUI++feMlLaTfEg9Cm3SlGF9LBfb33EPXbbZjVLKjHQr2njwsy0 O5Vu/Evvfy0Ol3nfXP6iW+bh2kiT7Txz+DBZhw7x7T4CfoZn4du6knu/WfHrUWCR/XrJ rr4my0mARs4bbxXjaK4nWyy2UoHZReMPVdQDpAwg3VXkOL4x0BnS4lR+QGma329nxhvz M3Acm5A14W8OSlrGck9aRgqnynEqqMiIQwW02kyRHqWRq0D+XekiKCQ/BqeRw5npny7C ogGg== 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=tchJ5Wt+4J2Sc5zebxz52PjTVObw1mo1IYj5M3DlkAM=; b=j0qknqiaQ26vyBUtEuglYdPfi4MAeZS8tiwkhmKUS66/kPkRjXP1IqYuLrhbJziwdi qKHgz3AvDcSwhf7YhKKxtTKjOW0HeOeIo1mkDz5JcpGlxKOJ1IGY3MdOeJF5RAuVCOI7 WkeqswAvVrkb6i3XDqCjS3stt5+hLskeJaCH6Ts2q7oW7EJImrv8wjF1afCQRQaW+Gpf O89tIELMqAe0NSAe2zsQekzWLdH9YUuUgvkRNYdTwcMfo7H5rPc1Bq6rTZcLuRS1Oxst 1THz+kdJSS6UNmLQKdU60BaD+bZwXtCU3fWZ8q+kYcX59j/Di83y7JbRqUeUzVTCozQ8 LQYw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 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.10]) by gmr-mx.google.com with ESMTPS id f24si919588edw.3.2020.04.19.12.31.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Apr 2020 12:31:13 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.10; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4950LT37Jqz1rs1k; Sun, 19 Apr 2020 21:31:13 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4950LT3098z1qr55; Sun, 19 Apr 2020 21:31:13 +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 cNQsmRcKjsyl; Sun, 19 Apr 2020 21:31:12 +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:12 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 609BB4540577; Sun, 19 Apr 2020 21:31:12 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UyBO9uU7Mue0; Sun, 19 Apr 2020 21:31:10 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.38]) by babic.homelinux.org (Postfix) with ESMTP id D00B34540580; Sun, 19 Apr 2020 21:31:06 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] Add a check to get_cpiohdr Date: Sun, 19 Apr 2020 21:31:01 +0200 Message-Id: <20200419193104.22351-4-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.10 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/cpio_utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/cpio_utils.c b/core/cpio_utils.c index 51ac04c..da84057 100644 --- a/core/cpio_utils.c +++ b/core/cpio_utils.c @@ -34,6 +34,9 @@ int get_cpiohdr(unsigned char *buf, unsigned long *size, { struct new_ascii_header *cpiohdr; + if (!buf) + return -EINVAL; + cpiohdr = (struct new_ascii_header *)buf; if (strncmp(cpiohdr->c_magic, "070702", 6) != 0) { ERROR("CPIO Format not recognized: magic not found");