Security improvements
Improvements include * adding additional build flags that warn about stack-smashing and type conversion errors * run-time checks for valid function input values and adquate space for the result of arithmetic operations. * make sure default case for switch statements do something besides just assert * disable using env. var. debugging in release mode Change-Id: I5f048310c5c56e05d9ec31bcc273404d6a0dd646
This commit is contained in:
@@ -140,17 +140,16 @@ int ReadSysfsStr(std::string path, std::string *retStr) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IsInteger(const std::string & n_str)
|
||||
{
|
||||
if(n_str.empty() || ((!isdigit(n_str[0])) && (n_str[0] != '-')
|
||||
bool IsInteger(const std::string & n_str) {
|
||||
if (n_str.empty() || ((!isdigit(n_str[0])) && (n_str[0] != '-')
|
||||
&& (n_str[0] != '+'))) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
char * tmp;
|
||||
strtol(n_str.c_str(), &tmp, 10);
|
||||
char * tmp;
|
||||
strtol(n_str.c_str(), &tmp, 10);
|
||||
|
||||
return (*tmp == 0);
|
||||
return (*tmp == 0);
|
||||
}
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
Reference in New Issue
Block a user