Presentation is loading. Please wait.

Presentation is loading. Please wait.

C Security Pre Function

Similar presentations


Presentation on theme: "C Security Pre Function"— Presentation transcript:

1 C Security Pre Function
Pepper

2 Standards The CERT C Secure Coding Standard
CSC270 is Not testing on these Familiarity Sometimes without the reason

3 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”);

4 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

5 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


Download ppt "C Security Pre Function"

Similar presentations


Ads by Google