Yeah, I did not think of using the `-fsanitize` flag with GCC or clang; good 
catch Rob.

First I saw this line `strncat(dst + len, src, sizeof(dst) - len - 1);` 
and thought as you that will overflow due to the limination of 24 bytes;
then I decided to double-check with man pages and have found this:

`char *strncat(char *restrict dest, const char *restrict src, size_t n);`

So, silly me thought it was some kind of pointer magic that could possibly 
work behind the scenes (?), but 24 bytes and then 26 characters should have
made it quite obvious it *is* an actual overflow, regardless of line
`strncat(dst + len, src, sizeof(dst) - len - 1);`.

Oh well...

Today I was reminded of using my sanitizer flag more often lol.

Thank you Rob.

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to