Message ID | 20200412131214.12932-1-sbabic@denx.de |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBCXPLOXJ6IKRBM5HZT2AKGQEXUZR6MI@googlegroups.com> 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::43b; helo=mail-wr1-x43b.google.com; envelope-from=swupdate+bncbcxploxj6ikrbm5hzt2akgqexuzr6mi@googlegroups.com; receiver=<UNKNOWN>) 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=dvkmNKU9; dkim-atps=neutral Received: from mail-wr1-x43b.google.com (mail-wr1-x43b.google.com [IPv6:2a00:1450:4864:20::43b]) (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 490XGb0ZXSz9sSg for <incoming@patchwork.ozlabs.org>; Sun, 12 Apr 2020 23:12:22 +1000 (AEST) Received: by mail-wr1-x43b.google.com with SMTP id j16sf4283783wrw.20 for <incoming@patchwork.ozlabs.org>; Sun, 12 Apr 2020 06:12:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1586697140; cv=pass; d=google.com; s=arc-20160816; b=ZSgNJ+ZZFruemX6tki/xcLnc7xSUZoJ8u9SXIylQ7WgJ15idVbakIql9Q63haYNBpU UHcWORkLzsYujqfDRl7tgJExM9pSKFKrxPrcmCbzG3j/XYhznjiYzJwh1Vi5BZRFOuFN siKBh1/bcvlr3eAxpxYrkLiKkagvtR7YlGXMPBkuTdfgyoeuuBPtwjdYq6kGUCd2spcx nloIupJ5xJi2sjXhghhdhNt5EJf2RQyhgo6oJ5sZGQ9s/kmNh9P/3G9vlkxHw+NqahQz N6ONViBsXJaXc6XmaXtufk/9k7Xe5dDLNw4fbO3DeIEvwNL8NSh2uN5XZvUh4F4T9rwL X6xg== 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:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=gdAjSyZ1h9aMFJXjS38e8QyZbXfaB7hHld7rZ6X8do4=; b=aa9OtgxU9fgZxZsug6Q42RB9BPdsazaE2eRZOn4YH3ry5amZ7gRszoUyRhKm4bKCmh QhJlLZU4yb1S8awHams9K++/VXBQnpEGJw+gdPISn/gGdtwwZEVoc4yawNzH+0ZkVtoN qoJjhEpqjbkBfxOiNFtIMY5tgJ0+/FCBp8TTxb/6fp957fV3bEWsLWaGC6mWB43rW3bN mBQt5cM+pfZPSd+BrpCW2xsNCqEBGrFQ2iJ6m+Dl+zG7I/8Wa27z9SrvsHgdZJIfl2il v7Kfv52362NFbC7Oem488IRaKyER7WW6TzPBpgWIpVGZFFuYBxQfF6XVGFZiwf2MePGP lFSw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 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: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=gdAjSyZ1h9aMFJXjS38e8QyZbXfaB7hHld7rZ6X8do4=; b=dvkmNKU9E163lohicylxDNPp+uvKYICx1L2Ry+SCpf3L3QtyMeMMTjugOoiOqtcbWT 9Se4V3bdK2kOIJ6cagB+3AZo8s4TvxMyGn0KtbVnsOkVs05lqGqnVk+GhCAMU0g8o7JD Bq8H37nB0SeyYLlFayN0nfZVKOqEelus1zW7LQX5VyJMtmbq7mu6VaJD2VA3uIpZ0EKK 6uh5zJYKDMy2pPqz1kjaAFOd1hCx5meGK3tses76IXr6XQPZTqyUtukx0RAoEyAw0TeM GKP4sOluH8we4ZHJolgZsJmqLKzezdHEijl+TF1G1tqP/d9mnJxlB4HISSV5EasLKqp8 AiPA== 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 :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=gdAjSyZ1h9aMFJXjS38e8QyZbXfaB7hHld7rZ6X8do4=; b=LnT6MsbLnLCeAtop3BzGsEUn4vAUkq0mAqR6Gsl+YIzqKQcfahJKrWr8yfZ5DRRp6u MaOUyhBmvisLfsJhpQnfmtGPd/qsi1PCO/4Qt4GVx+n4hZDxit0EXZlpck2PYe9KoB+D leri4Wix+cxnkzta8qTixwVlhwyZG5ngUjex4JJNvWQoBgMu7L0ICYx/nee8yOUe7Rlf X5VTtHWkc0ym3o60oYQsdJHM8dzra5VyAK0ZQgplvFLJQV/y8P1OLWTYSSe+mSn41eku QP+YQSQH/a4UfbmDqi8K0vKaR/PRmx/ONiI1ySAFv3QlsUAZmk72Ve/BMk+6f6S4ooh0 vxJg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AGi0PuYOwEkxFGErc3ZVEXj9fvKlkkhiK6r5YZcQlPOjNaizZP/IBLp9 HWhaA22sHG5d4pkeC5LBB+s= X-Google-Smtp-Source: APiQypLi9NktcXTJmKTI68WKlKP4rLeLF9QgWg2GJGVtoYilZTbVzRgYqKfqjPeSmgf8d7KD4C7eEw== X-Received: by 2002:a1c:4946:: with SMTP id w67mr14801748wma.38.1586697139877; Sun, 12 Apr 2020 06:12:19 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a1c:7ec2:: with SMTP id z185ls3508258wmc.1.canary-gmail; Sun, 12 Apr 2020 06:12:19 -0700 (PDT) X-Received: by 2002:a1c:b144:: with SMTP id a65mr15148123wmf.54.1586697139269; Sun, 12 Apr 2020 06:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586697139; cv=none; d=google.com; s=arc-20160816; b=AgekL9eyoRxApQxxjFp6vjp3tR2U8WvbjGDkFMOa16pqhzqj9jIaTbA1NneMcS1RAp W1OwA8Uq7Vg//VI47eCCiLUieLG7JQG3rV2CNFuZP3IQN26kzL1C5ldH4/bjY0Dw0t36 RXEVrCdfkEav9M0qbIb1IIGTZ4gS+We1ow4Ebivlm/BTnVzPTAAzHAQHXeBYYumjaPWD qOav1z+fxyS30vI+TNkYmUbK30M9jcuhmNnRh2j1ulI584aps3hYr8ptRC5XjGyQZiMc lTLwqgsEEdXPYSKCC+YoPTQsPNmMvj3iJziXim/Us5xThdIKLSVFh2qhEgVhhhkZLcBF 8HKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=ZB3EKDc5nhImUiMVA3l1mIYX+J9FtNxCsCk+ujUtOU0=; b=rHsDoDG+WN3K3YiRE8ESQVfo9NOKNAHGPowWjSVY4Ta9k+EK8EiePQVQrjCByJ8yTe EOLSQZE7MRA+yOhKegPrFQyHtcax7M6siS6rPYcgpQN7eCNQz3d+j3f2Hlt9Qpi0lRbK d/5yBYu7x9gdCQwNhEB+i403kMd0xJmHLj3YVRL1N91xUSNUutyKcxXwtnTHri9iEiHA kLofo5IgQajZiLVebAFQSSxg+v5I9HkHaTNDyqbe1ShZg1nZ5jdBLeKJb6D05wOMll3t qFqSV2VESTAkDmnZniMKhG/eW5R0paqE1KBvfMydl2lkuKmLG3A95qBL0P7xiDxCWvtd PXGQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 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. [2001:a60:0:28:0:1:25:1]) by gmr-mx.google.com with ESMTPS id u23si653120wmn.0.2020.04.12.06.12.19 for <swupdate@googlegroups.com> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Apr 2020 06:12:19 -0700 (PDT) Received-SPF: neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=2001:a60:0:28:0:1:25:1; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 490XGW0RZCz1rqRQ; Sun, 12 Apr 2020 15:12:19 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 490XGW0DNDz1r0c9; Sun, 12 Apr 2020 15:12:19 +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 l1SgUXj32rQm; Sun, 12 Apr 2020 15:12:18 +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, 12 Apr 2020 15:12:18 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id B2C6C45405D1; Sun, 12 Apr 2020 15:12:17 +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 dvervdbmkVPc; Sun, 12 Apr 2020 15:12:15 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.38]) by babic.homelinux.org (Postfix) with ESMTP id 55EC0454053E; Sun, 12 Apr 2020 15:12:15 +0200 (CEST) From: Stefano Babic <sbabic@denx.de> To: swupdate@googlegroups.com Cc: Stefano Babic <sbabic@denx.de> Subject: [swupdate] [PATCH] Fix coverity #292459 Date: Sun, 12 Apr 2020 15:12:14 +0200 Message-Id: <20200412131214.12932-1-sbabic@denx.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
Fix coverity #292459
|
expand
|
diff --git a/core/cpio_utils.c b/core/cpio_utils.c index dc6d508..ca67cb2 100644 --- a/core/cpio_utils.c +++ b/core/cpio_utils.c @@ -643,7 +643,7 @@ int copyimage(void *out, struct img_type *img, writeimage callback) int extract_cpio_header(int fd, struct filehdr *fhdr, unsigned long *offset) { - unsigned char buf[256]; + unsigned char buf[sizeof(fhdr->filename)]; if (fill_buffer(fd, buf, sizeof(struct new_ascii_header), offset, NULL, NULL) < 0) return -EINVAL; if (get_cpiohdr(buf, &fhdr->size, &fhdr->namesize, &fhdr->chksum) < 0) { @@ -658,6 +658,7 @@ int extract_cpio_header(int fd, struct filehdr *fhdr, unsigned long *offset) return -EINVAL; } + buf[fhdr->namesize] = '\0'; if (fill_buffer(fd, buf, fhdr->namesize , offset, NULL, NULL) < 0) return -EINVAL; strlcpy(fhdr->filename, (char *)buf, sizeof(fhdr->filename));
Signed-off-by: Stefano Babic <sbabic@denx.de> --- core/cpio_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)