Skip to content

Commit

Permalink
- ACSE: fixed out-of-bounds read in parseAarqPdu function (LIB61850-4…
Browse files Browse the repository at this point in the history
…41)(#512)
  • Loading branch information
mzillgith committed Jun 12, 2024
1 parent ac17349 commit 501dffe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mms/iso_acse/acse.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,17 @@ parseAarqPdu(AcseConnection* self, uint8_t* buffer, int bufPos, int maxBufPos)
int authMechLen = 0;
bool userInfoValid = false;

while (bufPos < maxBufPos) {
while (bufPos < maxBufPos)
{
uint8_t tag = buffer[bufPos++];
int len;

bufPos = BerDecoder_decodeLength(buffer, &len, bufPos, maxBufPos);

if (bufPos < 0) {
if (len == 0)
continue;

if ((bufPos < 0) || (bufPos + len > maxBufPos)) {
if (DEBUG_ACSE)
printf("ACSE: Invalid PDU!\n");
return ACSE_ASSOCIATE_FAILED;
Expand Down

0 comments on commit 501dffe

Please sign in to comment.