Skip to content

[rtext] Check for empty strings in TextToPascal and TextToCamel - #6213

Merged
raysan5 merged 2 commits into
raysan5:masterfrom
Ne0nWinds:text-pascal-null-terminator-check
Oct 4, 2026
Merged

raysan5 merged 2 commits into
raysan5:masterfrom
Ne0nWinds:text-pascal-null-terminator-check

Conversation

@Ne0nWinds

Copy link
Copy Markdown
Contributor

Both TextToPascal and TextToCamel read past the end of empty strings (""). These are the only two text functions that don't handle this case.

In both functions, the main for loop skips over index 0 and starts directly at index 1. This also inadvertently skips over the null-terminator check for index 0.

Solution: add a simple text[0] != '\0' check before the main loop in each function.

@raysan5

raysan5 commented Oct 4, 2026

Copy link
Copy Markdown
Owner

@Ne0nWinds please, could you add parenthesis to conditions, as per raylib code conentions, thanks

@raysan5
raysan5 merged commit 791dd6d into raysan5:master Oct 4, 2026
16 checks passed
@raysan5

raysan5 commented Oct 4, 2026

Copy link
Copy Markdown
Owner

@Ne0nWinds thanks for the review

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

Successfully merging this pull request may close these issues.

2 participants