From patchwork Sun Apr 19 19:31:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1273005 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::13b; helo=mail-lf1-x13b.google.com; envelope-from=swupdate+bncbcxploxj6ikrbbgo6l2akgqemcltf7q@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=Vv4FjKIE; dkim-atps=neutral Received: from mail-lf1-x13b.google.com (mail-lf1-x13b.google.com [IPv6:2a00:1450:4864:20::13b]) (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 4950Lc4mMPz9sSm for ; Mon, 20 Apr 2020 05:31:20 +1000 (AEST) Received: by mail-lf1-x13b.google.com with SMTP id v7sf3256451lfq.11 for ; Sun, 19 Apr 2020 12:31:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1587324677; cv=pass; d=google.com; s=arc-20160816; b=PvtRbf1wChdZpcC+c5jJCwAzAUC9341fUB/PuGUcutw9z/QYm22Jes/7kdHSLLCW2L MENEJjIrPnEMIwYOwqGdheo7XWKCyW1oz0BTVKXl1vXqXKPhuC02uKrCHzdWZykjzAI6 4ESRy6W2SWg4juP15ASl+1KB3ATVoFUiOlMOuouzOlvBmB2Ieg3d6sjFvwHdSwAxuzUp EDCpaayvTOQlQDaEpTnS9xN5MCohy6cHHHPI/94pLHK2vnzC4MmOuELEJMtZBwd4TiQl CFccj/4b2Egw5L3bMULwakI9mPWxsa3Z/zaw+3eVqn6XqELlyAvR6QKM64J4tk9u4OzU joZw== 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=knptqH6SdFJ1ojAiO43NIBuv1G56KO7zgHjmVqmO33c=; b=vC5DxFQph1X5OHMYryUUEg8hLhWWEc4tg55SWSH+pcnF4aJYk6ar8mIsxqOGzsUgcj so2SGFmi9wPAzdMqZ+gGYjW96/siR3jQ3LLzb/deubQ1B3dRAllkK8PVPKC00EVCs9DN KnWI8euDLazz+8bZNBMtdOu4/YZwzSHKCxIjsU+tEEM5ZdWKpgKYhUKPts0iXnYylIiu uAAHjd/UWlhLITzsMtUY2eiFII5USGose6FzND0V6q8N6Fi9AJxbDD8J4SHV7xR6QuQB MT339NyA1hHTvowBWhHHTuphQSOdOwecwYOaUMfRL8Rq/8Drhuw22PrIhaFRAbA4rz88 bmHA== 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: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=knptqH6SdFJ1ojAiO43NIBuv1G56KO7zgHjmVqmO33c=; b=Vv4FjKIEehqXJLKt9wx4xAhHgjshDZcrL4DJkxTjIl/Rw6oZrYg+Z4PXRklFJjQJ6T vCA1gnPzbCqnr8MQej9rdxrvarqIrJZSKVqXbkQLs9VAe9tyMgp1vFChOA2u1/YMgb9B zeDUKefnp0KpouNqQ4lg18vx5yNdBjQA18pXgLbuT1L1kbzF4+yqJU6Me6l1w2Yb3bRo n/KO/jrbbdGZuHHcRNkdrRzrgAVeyliWaiI9DhIM4ZBgk6dIklSZxK1xxgrWLBUC8Dqc qf6aty7IRK51FVAVxFQdXIBa5t+dmkuQvYa78+1sTKGEPRrPrGlr5MQPqLYj8+Z29lsZ jeDQ== 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=knptqH6SdFJ1ojAiO43NIBuv1G56KO7zgHjmVqmO33c=; b=N52qwlVrXtS8Et+tbGEsMJbKrRi8obJ1mO1fytRvgY8aZE+zwON+zjoE28vWSOgOnN i3t6A57kMRMeQV83TzxH4doWZMKwjQbzhjhvdxUPF+PlnauloIawXAjqGRth9nep82zl n/wwVvYkWnzQCD3nPqa9I59XzanS9ZUjL4SCc06EBkbSt0aPvsYLcOcGSng0PQDmyNuO Gh/Jaxg4iS9/KFAJZ1/vjOmtY3ofkY5mfRstvHVLiZdTjIQL4NUf8emHY8XsN8phc11L aRSO/unPrUAcYokoEG04hg1ID4+8VjOM7xLgX0ZrxPwZYYoCNEVQxW7BoCs9Dv5sUV9j dbsg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AGi0Pua/94Pxn3XbeSIj33fFXFZzKd/0hMY21sUDC1COfbClMkQI35jP c5vOqWhZSlCTonUHgSTFe3g= X-Google-Smtp-Source: APiQypLxcMul4q1n7biNb4UoK/q943htea1HCandIUgZstbfxg7aq7iKBGXEhQqCcVe/VlLxdF7vrg== X-Received: by 2002:a19:ad45:: with SMTP id s5mr8175866lfd.106.1587324677397; Sun, 19 Apr 2020 12:31:17 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:651c:2002:: with SMTP id s2ls1185567ljo.3.gmail; Sun, 19 Apr 2020 12:31:16 -0700 (PDT) X-Received: by 2002:a2e:8e98:: with SMTP id z24mr8196703ljk.134.1587324676499; Sun, 19 Apr 2020 12:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587324676; cv=none; d=google.com; s=arc-20160816; b=Q3cGyV4A5t81I9SLkEVhuT3ngkfmtqX07YbbFS0LiSXFqfHP/B8DyVBeHrUvcBG4Wc C4aI04P2oEhZJPdzpLxfi9JvjWvCQnaM0Lc7ePEBC5Rmrh758uotBbFP5TeFhEsvASQo Y+MZa5UWVO9gVpZS7L68kC45bQp5iQdIu550P8Nde+e7qm1uHGGloQn1CD14Mo7VBac5 oGOiMl16C+IT5lTKiZg2vrfJ/6N+dR3ud1oVMoyJ6u8Itauv/KS/IdXofPvpUe3CmHvv yCF3auPaa6wfM9Zbat/Tnw4yIJxk6x9YYgVv7j3JXgYq6iCrGDusfaQ33CAUu8lHilUC 1F3Q== 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=AzWyXPrZqnfHrZ+pqGtVejFHsPUki7X0tfEVhocfMIE=; b=rzQPZ9Nl8s+8GtqKEbfsSssiQjC2gHZtrqF+A+VWBTvCAIJ+YuL2TWSDGJ6NyLrifa h/uD6lHy/bfB+U39c5RqwEkufWA4E1RRec/VSXSlwL2xK2ajaboNXsTocxYrpsKEqt/N /0gPrPsBdhgChGkmQctG+Al8FqHvtBqSnOWrrI1N/kbM/7MVzIEymhqJHoBg4+I0HQEX ZrUNRFUIPc9Ue2b2fP7UfFmevChyy6gT58lRKosdWk5jqypugP41pWU9GQh4TcKIYoVG EbKiacX0XnGcmWKUoeANksxq0pVFWsy97NLWdaUyk3t+qMB9wej/T+oiefcSV/5Njfp7 OBrw== 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 j13si1330003lfj.1.2020.04.19.12.31.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Apr 2020 12:31:16 -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 4950LX01ggz1rs1k; Sun, 19 Apr 2020 21:31:16 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4950LW718lz1qr52; Sun, 19 Apr 2020 21:31:15 +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 PzWr02BDhecF; Sun, 19 Apr 2020 21:31:15 +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:15 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id CC3044540577; Sun, 19 Apr 2020 21:31:14 +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 SDO-PLzEwWYZ; Sun, 19 Apr 2020 21:31:12 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.38]) by babic.homelinux.org (Postfix) with ESMTP id 30F3A45406DC; Sun, 19 Apr 2020 21:31:07 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] Fix coverity #292132 Date: Sun, 19 Apr 2020 21:31:03 +0200 Message-Id: <20200419193104.22351-6-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: 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 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 --- handlers/ubivol_handler.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/handlers/ubivol_handler.c b/handlers/ubivol_handler.c index 21e88ec..008e9f7 100644 --- a/handlers/ubivol_handler.c +++ b/handlers/ubivol_handler.c @@ -564,13 +564,13 @@ static int swap_volume(struct img_type *img, void *data) /* swap first -> second */ rnvol.ents[2 * count + 0].vol_id = vol_id[0]; - rnvol.ents[2 * count + 0].name_len = strlen(name[1]); - strcpy(rnvol.ents[2 * count + 0].name, name[1]); + rnvol.ents[2 * count + 0].name_len = min(strlen(name[1]), UBI_MAX_VOLUME_NAME); + strlcpy(rnvol.ents[2 * count + 0].name, name[1], UBI_MAX_VOLUME_NAME); /* swap second -> first */ rnvol.ents[2 * count + 1].vol_id = vol_id[1]; - rnvol.ents[2 * count + 1].name_len = strlen(name[0]); - strcpy(rnvol.ents[2 * count + 1].name, name[0]); + rnvol.ents[2 * count + 1].name_len = min(strlen(name[0]), UBI_MAX_VOLUME_NAME); + strlcpy(rnvol.ents[2 * count + 1].name, name[0], UBI_MAX_VOLUME_NAME); count++; }