Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rtext] TextSubText() receives a length but scans forever for a null terminator #4057

Closed
SpicerXD opened this issue Jun 12, 2024 · 3 comments

Comments

@SpicerXD
Copy link

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?

Source

@raysan5
Copy link
Owner

raysan5 commented Jun 12, 2024

@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.

@raysan5 raysan5 changed the title TextSubText recieves a length but scans forever for a null terminator. [rtext] TextSubText() receives a length but scans forever for a null terminator Jun 12, 2024
@raysan5
Copy link
Owner

raysan5 commented Jun 13, 2024

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.

@raysan5 raysan5 closed this as completed Jun 13, 2024
@sday-ssc
Copy link

sday-ssc commented Jun 14, 2024

(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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants