Potential fix for code scanning alert no. 24: Use of potentially dangerous function (#220)
* Potential fix for code scanning alert no. 24: Use of potentially dangerous function Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * clang-format fix * use std::localtime_r instead of localtime. Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com> * localtime_r is defined in global namespace. --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Kandula, Venkateshwar reddy <Venkateshwarreddy.Kandula@amd.com> Co-authored-by: Madsen, Jonathan <Jonathan.Madsen@amd.com>
Este commit está contenido en:
@@ -68,7 +68,9 @@ get_local_datetime(const std::string& dt_format, std::time_t*& _dt_curr)
|
||||
char mbstr[strsize] = {};
|
||||
memset(mbstr, '\0', sizeof(mbstr) * sizeof(char));
|
||||
|
||||
if(std::strftime(mbstr, sizeof(mbstr) - 1, dt_format.c_str(), std::localtime(_dt_curr)) != 0)
|
||||
struct tm tm_struct;
|
||||
if(std::strftime(
|
||||
mbstr, sizeof(mbstr) - 1, dt_format.c_str(), localtime_r(_dt_curr, &tm_struct)) != 0)
|
||||
return new std::string{mbstr};
|
||||
|
||||
return nullptr;
|
||||
|
||||
Referencia en una nueva incidencia
Block a user