From c7f774ff0ade8efe292c00dd6ceb31c42d631278 Mon Sep 17 00:00:00 2001 From: umarcor Date: Mon, 2 Aug 2021 02:04:17 +0200 Subject: FIX pass the length to probably unterminated string extraction (cherry picked from commit afee8309e4b644e0e94c1938c0f4e211ae3038fa) --- pyGHDL/libghdl/str_table.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pyGHDL/libghdl') diff --git a/pyGHDL/libghdl/str_table.py b/pyGHDL/libghdl/str_table.py index 4cd138f44..f87e9db8b 100644 --- a/pyGHDL/libghdl/str_table.py +++ b/pyGHDL/libghdl/str_table.py @@ -48,7 +48,7 @@ def _String8_Address(Id: String8Id) -> c_char_p: @export -def Get_String8_Ptr(Id: String8Id) -> str: +def Get_String8_Ptr(Id: String8Id, Length: int) -> str: """ Get the address of string8 ID. Note that as soon as a character is appended (using Append_String8) or a string8 is resized (using Resize_String8), an @@ -57,4 +57,4 @@ def Get_String8_Ptr(Id: String8Id) -> str: :param Id: String8Id for the string to query. :return: String8 as string. """ - return _String8_Address(Id).decode("utf-8") + return _String8_Address(Id)[:Length].decode("utf-8") -- cgit v1.2.3