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: 1013415 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KZGPuRZK"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43GQWT0SpZz9s1c for ; Fri, 14 Dec 2018 20:40:01 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2AFA8C227BA; 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-Google-Smtp-Source: AFSGD/X0bXWC3YuGxYrHzPVtV8AZ4E8ahbLmoaSKcpo0kaHuGWHSG0wAcGQT29GKS8fUgu8Eg2SEog== 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 */