Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why data length in CS101_ASDU_addPayload is different with data length in MessageQueue_enqueueASDU #101

Open
sdoa5335717 opened this issue Dec 23, 2021 · 0 comments

Comments

@sdoa5335717
Copy link

In function CS101_ASDU_addPayload,
if (self->payloadSize + self->asduHeaderLength + size <= 256)...
the max length 256 is ASDU;
In function MessageQueue_enqueueASDU
int asduSize = asdu->asduHeaderLength + asdu->payloadSize;
if (asduSize > 256 - IEC60870_5_104_APCI_LENGTH) ...
the max length is more little value 250, that IEC60870_5_104_APCI_LENGTH is 6.

for example
I have data which length is 247, when I call CS101_ASDU_addPayload is success because 247+6<256, but when program call MessageQueue_enqueueASDU, asduSize is 247 + 6(asdu->asduHeaderLength) = 253, is bigger than 250(256 - IEC60870_5_104_APCI_LENGTH), so failed.

so I think (self->payloadSize + self->asduHeaderLength + size <= 250) is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant