Menu

#609 TModule::LoadString: String may include embedded null-terminator(s)

8
pending
Resource (5)
1
2025-05-10
2025-05-10
No

TModule::LoadString returns the full content of the raw string resource slot, which may include null-terminator(s). While a std::string can hold embedded null-terminators, this is not conventional use. The user normally expects std::string::size to return the length of the string, not including a terminator. Also, any content trailing the terminator is included, which may lead to further surprise (size > length + 1).

I propose stripping the returned string of any null-terminator and trailing content.

To load the full content of the raw string resource slot, in the rare circumstance support for embedded nulls is needed, the user can use TModule::FindResource and LoadResource instead, or use the bare Windows API.

Implemented in [r7849].

Related

Commit: [r7849]
Wiki: OWLNext_Roadmap_and_Prereleases

Discussion


Log in to post a comment.