cert.py: Add ENV33-C (#2377)

This commit is contained in:
Georgy Komarov 2019-11-21 08:46:46 +03:00 committed by Daniel Marjamäki
parent df952926f8
commit b9bc5d6d78
2 changed files with 20 additions and 3 deletions

View File

@ -233,6 +233,16 @@ def int31(data, platform):
'Ensure that integer conversions do not result in lost or misinterpreted data (casting ' + str(value.intvalue) + ' to ' + destType + ')',
'INT31-c')
break
# ENV33-C
# Do not call system()
def env33(data):
for token in data.tokenlist:
if isFunctionCall(token, ('system',), 1):
reportError(token, 'style', 'Do not call system()', 'ENV33-C')
# MSC24-C
# Do not use deprecated or obsolescent functions
def msc24(data):
@ -399,6 +409,7 @@ if __name__ == '__main__':
str05(cfg)
str07(cfg)
str11(cfg)
env33(cfg)
msc24(cfg)
msc30(cfg)
api01(cfg)

View File

@ -21,12 +21,12 @@ void api01()
}
struct good_node_s
{
struct good_node_s* next;
struct good_node_s* next;
char name[String_Size];
}
struct also_good_node_s
{
struct also_good_node_s* next;
struct also_good_node_s* next;
char *name;
}
}
@ -74,12 +74,18 @@ unsigned char int31(int x)
x = (unsigned long long)-1; // cert-INT31-c
}
void env33()
{
system("chmod -x $(which chmod)"); // cert-ENV33-C
int system;
}
void msc24()
{
struct S {
int x; int fopen;
};
struct S s;
time_t rawtime;
struct tm *timeinfo;