]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
hashtable: fix length calculation in hexport_r
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Fri, 14 Dec 2018 09:42:51 +0000 (18:42 +0900)
committerTom Rini <trini@konsulko.com>
Sat, 15 Dec 2018 16:49:19 +0000 (11:49 -0500)
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

index 1c48692b69ede8b1045d7a8deb4706ba0d1ad84a..93028ed83b2677f9dd83d1f2a16abbcd9f3d2d37 100644 (file)
@@ -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 */