From 0287b5a864ba6a567e6fef1b99cf001481fd59e2 Mon Sep 17 00:00:00 2001 From: Alex Burmashev Date: Tue, 16 Feb 2021 06:58:05 -0500 Subject: [PATCH] strndupa: allocate len + 1, so that \0 is not lost Signed-off-by: Alex Burmashev --- include/str.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/str.h b/include/str.h index 14089c7..a6fbfef 100644 --- a/include/str.h +++ b/include/str.h @@ -55,7 +55,7 @@ strndupa(const CHAR8 * const src, const UINTN srcmax) return news; len = strnlena(src, srcmax); - news = AllocateZeroPool(len); + news = AllocateZeroPool(len + 1); if (news) strncpya(news, src, len); return news;