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 2023-01-15 23:24:24 -0500

yoshiwara's avatar

updated 2023-01-16 09:47:32 -0500

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.

edit retag flag offensive reopen merge delete

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  ( 2023-01-17 02:32:11 -0500 )edit

Thank you for posting this issue and quick fix.

yoshiwara's avatar yoshiwara  ( 2023-01-17 02:51:50 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-01-17 02:41:30 -0500

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

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

edit flag offensive delete link more

Comments

1

Thank you for posting this issue and quick fix.

yoshiwara's avatar yoshiwara  ( 2023-01-17 02:54:30 -0500 )edit

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2023-01-15 23:24:24 -0500

Seen: 71 times

Last updated: Jan 17 '23