First time here? Check out the Help page!

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

Client programs may crash by calling listAllAPIDataCSV of EnergyPlus API. [closed]

asked 2 years ago

yoshiwara's avatar

updated 2 years ago

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.

Preview: (hide)

Closed for the following reason the question is answered, right answer was accepted by yoshiwara
close date 2023-01-17 02:53:00.752050

Comments

I think you are right. That said, this type of things should be best posted as an issue directly at https://github.com/NREL/EnergyPlus/is....

Julien Marrec's avatar Julien Marrec  ( 2 years ago )

Thank you for posting this issue and quick fix.

yoshiwara's avatar yoshiwara  ( 2 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 2 years ago

Posted as an issue here: https://github.com/NREL/EnergyPlus/is...

With a Pull request fixing it at https://github.com/NREL/EnergyPlus/pu...

Preview: (hide)
link

Comments

1

Thank you for posting this issue and quick fix.

yoshiwara's avatar yoshiwara  ( 2 years ago )

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2 years ago

Seen: 80 times

Last updated: Jan 17 '23