[rtext] `TextSubText()` receives a length but scans forever for a null terminator
SpicerXD opened this issue · comments
Ran into this and was confused on why this is the behavior.
I would expect it to only scan for null up to the length ask for.
Not sure what it should do though if it doesn't encounter one.
Put null on the last character?
@SpicerXD I'm afraid I can't see the issue, it gets the textLength of provided text to verify the following parameters do not go out of that range, it's just a security check.
Reviewed the function and I can't see the issue, please provided a more detailed description and an error code sample that illustrates the issue if it persists.
(This is @SpicerXD, I'm just on a work account.)
Sorry, I'll be more clear.
TextSubText can be given a position and a length.
But it will first call TextLength on that source text. Which will scan for a null or segfault if it doesn't find one.
I think it'd be safer if the length check in TextSubText instead only checked for null up to position + length.