libluna: Fix String::from_string_view construction for inline strings
All checks were successful
Build and test / build (push) Successful in 1m41s
All checks were successful
Build and test / build (push) Successful in 1m41s
Before, this method failed to add a null terminator if the source string did not have one, which was possible.
This commit is contained in:
parent
644614cdd8
commit
4dc060e0b3
@ -155,7 +155,8 @@ Result<String> String::from_string_view(StringView str)
|
||||
String result;
|
||||
result.m_inline = true;
|
||||
result.m_length = str.length();
|
||||
strncpy(result.m_inline_storage, str.chars(), sizeof(m_inline_storage));
|
||||
memset(result.m_inline_storage, 0, sizeof(result.m_inline_storage));
|
||||
memcpy(result.m_inline_storage, str.chars(), str.length());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user