sheredom / utf8.h

📚 single header utf8 string functions for C and C++
The Unlicense
1.71k stars 122 forks source link

Crash waiting to happen? #30

Closed codecat closed 8 years ago

codecat commented 8 years ago

So I stumbled upon this: https://github.com/sheredom/utf8.h/blob/master/utf8.h#L697

Is this a crash waiting to happen, or am I reading the logic wrong?

If both h and n are equal strings, this will read past the memory of those strings.

sheredom commented 8 years ago

Hmm you are probably right! I'll add a test for that and we'll make sure it fails, then probably have to add on a check for null terminator there too.

Good find thanks! :smile: