r/C_Programming • • Oct 10 '26

Strict RFC 3629 UTF-8 Validator in C - Catches Overlongs and Surrogates

I needed a pure, zero-dependency UTF-8 validator for a systems project to protect user input boundaries like usernames.

Instead of a basic range check, this strictly follows the RFC 3629 spec to block security vulnerabilities like overlong encoding exploits (e.g. 0xC0 0xAF) and invalid UTF-16 surrogates.

1 Upvotes

5 comments sorted by

8

u/flyingron Oct 10 '26 edited Oct 10 '26

Videos are a poor way to relay coding concepts. Further, if you want to share something or have a question, it would be best to link to the code rather than showing pictures of it.

2

u/[deleted] Oct 10 '26

[removed] — view removed comment

1

u/flyingron Oct 10 '26

My apologies. Cranky this morning. Fixed.