diff mbox series

[U-Boot] hashtable: fix length calculation in hexport_r

Message ID 20181214094251.8779-1-takahiro.akashi@linaro.org
State Accepted
Commit 4bca32497c09ef53ad669dfa4c413c00321ad7ca
Delegated to: Tom Rini
Headers show
Series [U-Boot] hashtable: fix length calculation in hexport_r | expand

Commit Message

AKASHI Takahiro Dec. 14, 2018, 9:42 a.m. UTC
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 <takahiro.akashi@linaro.org>
---
 lib/hashtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini Dec. 17, 2018, 12:10 p.m. UTC | #1
On Fri, Dec 14, 2018 at 06:42:51PM +0900, AKASHI Takahiro wrote:

> 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 <takahiro.akashi@linaro.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

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 */