FINALLY A SOULTION!!!
the problem was that in that file were a \x00 character, which most of the string.h functions, consider this EOF but in that case it wasn’t, like strlen(), strcat() and so on.
I stopped using functions like those started safely and carfully handle binary strings.