CPP: Extend coverage.

This commit is contained in:
Geoffrey White
2019-04-04 16:31:02 +01:00
parent a1e503f428
commit a437e6c103
3 changed files with 14 additions and 6 deletions

View File

@@ -1,3 +1,6 @@
| test.c:31:22:31:27 | call to gmtime | Call to gmtime is potentially dangerous |
| test.c:42:2:42:5 | call to gets | gets does not guard against buffer overflow |
| test.c:43:6:43:9 | call to gets | gets does not guard against buffer overflow |
| test.c:48:19:48:27 | call to localtime | Call to localtime is potentially dangerous |
| test.c:49:22:49:26 | call to ctime | Call to ctime is potentially dangerous |
| test.c:50:23:50:29 | call to asctime | Call to asctime is potentially dangerous |

View File

@@ -45,7 +45,7 @@ void testGets() {
void testTime()
{
struct tm *now = localtime(time(NULL)); // BAD: localtime uses shared state [NOT DETECTED]
char *time_string = ctime(time(NULL)); // BAD: localtime uses shared state [NOT DETECTED]
char *time_string2 = asctime(now); // BAD: localtime uses shared state [NOT DETECTED]
struct tm *now = localtime(time(NULL)); // BAD: localtime uses shared state
char *time_string = ctime(time(NULL)); // BAD: localtime uses shared state
char *time_string2 = asctime(now); // BAD: localtime uses shared state
}