C Security Pre Function Pepper
Standards The CERT C Secure Coding Standard CSC270 is Not testing on these Familiarity Sometimes without the reason
Avoid Single Argument Printf When you are just printing one line without any variables, use one of the following: puts (string); (the \n will be appended) printf(“%s”, string); Ex bad: printf(“hello\n”); Ex good: puts(“hello”); printf(“%s”, “hello”);
Arithmetic Overflow Sum = integer1 + integer2 can yield a number too large for an integer. <limits.h> holds INT_MAX and INT_MIN Check before calculating Unsigned ints: UNIT_MAX from <limits.h> trap negative entries
Scanf’s return value If input fails (wrong type), returns EOF (defined in <stdio.h>) If it succeeds, it returns the number of variables read Check that the number read is successful Also validate range