EIPStackGroup / EIPStackGroup/OpENer
building against OpENer as external library fails due to missing definitions
- Dominant language
- C
- Stars
- 857
- Forks
- 314
- Avg merge
- 18d 2h
- Merged PRs (30d)
- 1
Description
The declaration of type `ENIPMessage` in file *enipmessage.h* contains `PC_OPENER_ETHERNET_BUFFER_SIZE` as buffer size for the message buffer inside of that struct:
```c
typedef struct enip_message {
CipOctet message_buffer[PC_OPENER_ETHERNET_BUFFER_SIZE];
CipOctet *current_message_position;
size_t used_message_length;
} ENIPMessage;
```
It is part of *libUtils* and used by other parts of the stack. The file *enipmessage.h* is included by other headers and installed, so can be considered part of the public API of the stack. The value PC_OPENER_ETHERNET_BUFFER_SIZE however is not only referenced in that header but used in various places of the stack's code. It is passed as preprocessor option at build time of the stack and comes from the CMake files through an `add_definition()` statement which takes the CMake option `OPENER_ETHERNET_BUFFER_SIZE` as input.
This leads to the following situation: there is this build time option (OPENER_ETHERNET_BUFFER_SIZE) which results in hardcoded array sizes of the built stack. When **later** building against the stack as external library the same value is required as preprocessor definition but it's defined nowhere and you don't get it from public API headers. So it is essentially impossible to know its value at build time of an app. You need to guess.
An app using a different value for `PC_OPENER_ETHERNET_BUFFER_SIZE` as the stack used will probably crash?!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.