Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Client programs may crash by calling listAllAPIDataCSV of EnergyPlus API.

I found a bug in a source file of EnergyPlus/api/datatransfer.cpp. (Version 22.1.0)

At the end of the definition of listAllAPIDataCSV function, there are following codes.

char *p = new char[std::strlen(output.c_str())];
std::strcpy(p, output.c_str());
return p;

I think that strcpy function copies null character after the string, so length of new char[] has to be strlen() + 1 byte or more.

Client programs may crash by calling listAllAPIDataCSV of EnergyPlus API.

I found a bug in a source file of EnergyPlus/api/datatransfer.cpp. EnergyPlus/api/datatransfer.cc. (Version 22.1.0)

At the end of the definition of listAllAPIDataCSV function, there are following codes.

char *p = new char[std::strlen(output.c_str())];
std::strcpy(p, output.c_str());
return p;

I think that strcpy function copies null character after the string, so length of new char[] has to be strlen() + 1 byte or more.

Client programs may crash by calling listAllAPIDataCSV of EnergyPlus API.

I found a bug in a source file of EnergyPlus/api/datatransfer.cc. (Version 22.1.0)22.2.0)

At the end of the definition of listAllAPIDataCSV function, there are following codes.

char *p = new char[std::strlen(output.c_str())];
std::strcpy(p, output.c_str());
return p;

I think that strcpy function copies null character after the string, so length of new char[] has to be strlen() + 1 byte or more.

Client programs may crash by calling listAllAPIDataCSV of EnergyPlus API.

I found a bug in a source file of EnergyPlus/api/datatransfer.cc. (Version 22.2.0)

At the end of the definition of listAllAPIDataCSV function, there are following codes.

char *p = new char[std::strlen(output.c_str())];
std::strcpy(p, output.c_str());
return p;

I think that strcpy function copies null character after the string, so length of new char[] has to be strlen() + 1 byte or more.