From patchwork Fri Dec 14 09:42:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 153790 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1853547ljp; Fri, 14 Dec 2018 01:39:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/XIJEgXnqfPjdT+bLZhW0wgKXcIsR4puCt9hRXx0VS44/9SGPDrMztpc0v7Xw4Xe/y9ltkm X-Received: by 2002:a17:906:9613:: with SMTP id s19-v6mr1888218ejx.109.1544780397850; Fri, 14 Dec 2018 01:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544780397; cv=none; d=google.com; s=arc-20160816; b=BVpVAYJ+xNrA2gLtK8JPSWnQGav91n54Qlxmi8OejYmoIY1di7+RHKpIM1Imzuj/QZ tRwiA++W9Kgag9+X0qv6Lw2lN8KbHaeT38ZlvognsQI2oF5Dl8BKDuXp9sZ7N4Z+rFOJ 9qGOAvQ+3p1Z33x1nJ54PJImRna2Uy20wBOOnPIbCO8hNfEfD/A0WnbluXlwk/Y70LCh ZDveARMG5MXlnc0lascR0eSLTGIAvQm312m3aVS63YMwWg4oFqkLSA9QF6U2UY/3AxbB +BRHJoBMBzqzv28qtSN8UpVKpsK+IyMEXU5fk+GCMN6B+wCEmrT5BvDUNZSHOPyP1yJf KPeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:message-id:date:to:from:dkim-signature; bh=VDzhtXv5y0kbsg4wCP6EaljHcurKZV+H9DgfH3KeBKM=; b=vv8rJGlqX6/zXThjCF6NKYRjIMNlhLJJgbxmhop/bi3bu8FvAsGM5cnAkeS+YiDJRj 4b/2B/wDl2BQoDUZx+GpQ7rAFtiCCzq7r17Pj0y9uEygvHgnX86wxNYWSqv2EN7WruiC gaBBW7BgvX/Y3YxuQFBOs20I0J8sf0IlEo1+I7oeNFYHypa5ARguHB5SWkNluZUnYFHE UA5HY9MwHp0OOepPqXWMX8h6k0ZcJstqgo0kl/I4eW4fKIGhL7wHXSJEdXjso0uOBp0p v536XEyKUqMhyNb6MNHSW9JeTAXzeS6bj0jOh4J2I/MIEso+XnhfX5fUhIahsWRKkAOg oZEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KZGPuRZK; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id c18si1800256edr.216.2018.12.14.01.39.57; Fri, 14 Dec 2018 01:39:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KZGPuRZK; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 22382C22782; Fri, 14 Dec 2018 09:39:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 544A8C21F49; Fri, 14 Dec 2018 09:39:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6AF71C21F49; Fri, 14 Dec 2018 09:39:52 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) by lists.denx.de (Postfix) with ESMTPS id E0A53C21EA8 for ; Fri, 14 Dec 2018 09:39:51 +0000 (UTC) Received: by mail-yw1-f67.google.com with SMTP id n21so988015ywd.10 for ; Fri, 14 Dec 2018 01:39:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7CS3VFvhPIP2IiQFzWpZ8BNOHkhOAZi/eslpDMzjv7g=; b=KZGPuRZKaKUYruF7IhZeoQgzdfsNsnPa5xm5V8UYnsaf7j8uTs2hMLG2TrRpznMRdL O38+wtCAW218xxPsl1CgDYyhGYb3F0FjDr8YBbxKATjjcwqmNtMe/wGepkANdVyQA97C GvwWzxNBK5UPxoCsKbgxTlpbPejVaE4zgdJ0U= 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:mime-version :content-transfer-encoding; bh=7CS3VFvhPIP2IiQFzWpZ8BNOHkhOAZi/eslpDMzjv7g=; b=R8xLncnLKQVtHvzDOGdiKRnHr2ZcC9zv3czIb30wmDOr5sXmyCPqBw1C8PVPMpEeuS HvR0IsNYRbwWjekGvxqsr7qu3BHxiNU2AYmv0vP1Kj3XBIO4WXYARhTyZBt07AZNf8Ws vXcFgTC+/XgEbrPBbZq9TKasb9KME99009iEo//RzW51mx98GPSmi1JoiFuQLWvvm6y8 br16Joa4sikhr+Bv5sxK2gfOnrXy/ciTxcvfNq3VInfhBUNgG8t7800tPwRJNLgj4gNk MgaQDiVvyXAtz+074tO3s6LmhB1O5RVG8OnNkw6bgC3hQ8JK5+Kp1wy+Z05A6nl2ieAo ofSw== X-Gm-Message-State: AA+aEWbWeHXKh23hnSK9hTi4OwfRFzzwfKz2LucE99ajMEClxBiTK7Ir mv+5hNnyoQXgtIbNffeYyGN0LA== X-Received: by 2002:a81:5389:: with SMTP id h131mr2173554ywb.373.1544780390583; Fri, 14 Dec 2018 01:39:50 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id n65sm1238857ywf.15.2018.12.14.01.39.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 01:39:49 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com Date: Fri, 14 Dec 2018 18:42:51 +0900 Message-Id: <20181214094251.8779-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] hashtable: fix length calculation in hexport_r X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The commit below incorrectly fixed hexport_r(); > size = totlen + 1; One extra byte is necessary to NULL-terminate a whole buffer, "resp." Fixes: f1b20acb4a03 ("hashtable: Fix length calculation in hexport_r") Signed-off-by: AKASHI Takahiro --- lib/hashtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hashtable.c b/lib/hashtable.c index 1c48692b69ed..93028ed83b26 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -662,7 +662,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag, return (-1); } } else { - size = totlen; + size = totlen + 1; } /* Check if the user provided a buffer */