sqc 0.4.13

Software Code Quality - CERT C compliance checker
1
2
3
4
5
6
7
8
9
10
11
/*
 * Rule: ERR07-C
 * Status: FAIL - ctime has undefined behavior on localtime failure
 */

typedef long time_t;
char *ctime(const time_t *timer);

void f(time_t t) {
    char *str = ctime(&t);  /* VIOLATION: use asctime/localtime */
}