CheckBufferOverrun.cpp: Bug fixes
This commit is contained in:
parent
f99a79de9b
commit
000d5c0249
|
@ -33,13 +33,9 @@ void CheckBufferOverrun()
|
||||||
{
|
{
|
||||||
const char *varname = getstr(tok,1);
|
const char *varname = getstr(tok,1);
|
||||||
unsigned int size = strtoul(getstr(tok,3), NULL, 10);
|
unsigned int size = strtoul(getstr(tok,3), NULL, 10);
|
||||||
int total_size = 0;
|
int total_size = size * SizeOfType(tok->str);
|
||||||
if (strcmp(tok->str,"char") == 0)
|
if (total_size == 0)
|
||||||
total_size = size * sizeof(char);
|
continue;
|
||||||
else if (strcmp(tok->str,"int") == 0)
|
|
||||||
total_size = size * sizeof(int);
|
|
||||||
else if (strcmp(tok->str,"double") == 0)
|
|
||||||
total_size = size * sizeof(double);
|
|
||||||
int _indentlevel = indentlevel;
|
int _indentlevel = indentlevel;
|
||||||
for (TOKEN *tok2 = gettok(tok,5); tok2; tok2 = tok2->next)
|
for (TOKEN *tok2 = gettok(tok,5); tok2; tok2 = tok2->next)
|
||||||
{
|
{
|
||||||
|
@ -70,8 +66,6 @@ void CheckBufferOverrun()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (total_size > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
// memset, memcmp, memcpy, strncpy, fgets..
|
// memset, memcmp, memcpy, strncpy, fgets..
|
||||||
if (strcmp(tok2->str,"memset")==0 ||
|
if (strcmp(tok2->str,"memset")==0 ||
|
||||||
|
@ -92,7 +86,6 @@ void CheckBufferOverrun()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Loop..
|
// Loop..
|
||||||
|
|
Loading…
Reference in New Issue