C often seems to be taught in terms of contracted examples without much regard to code safety, such as buffer overflows etc. I have often wondered if there are proven, totally safe ways of writing C code, because I have seldom encountered C written to handle all eventualities correctly. And now, reading that even the best Gnome programmers make exactly these same errors in C, I think it is time to ask this question here.
In the porting work Mena noticed a number of actually usual errors in the C code such as overflows, which unfortunately are not always obvious. The code for some of these errors comes from the Mena's best C programmers, the Gnome Project ever had. This does not mean that the project has no good programmers. The reason for these mistakes is not people, but rather the language C itself, which is simply "hostile".
So, is it even possible to write safe C? Are there resources which explain how to avoid all these pitfalls?
scanf", maybe I should narrow it down to "What guidelines exist to avoid buffer overflows at all times".