From 504c26066725a67bb1d354e8be0ab5f1f4aff956 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Tue, 25 Aug 2020 11:21:41 +0200 Subject: [PATCH] - fixed program crash when normal mode parameers are missing in presentation layer (#252) --- src/mms/iso_presentation/iso_presentation.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mms/iso_presentation/iso_presentation.c b/src/mms/iso_presentation/iso_presentation.c index 6818e260..e5dd95e2 100644 --- a/src/mms/iso_presentation/iso_presentation.c +++ b/src/mms/iso_presentation/iso_presentation.c @@ -677,6 +677,7 @@ IsoPresentation_parseConnect(IsoPresentation* self, ByteBuffer* byteBuffer) { uint8_t* buffer = byteBuffer->buffer; int maxBufPos = byteBuffer->size; + bool hasNormalModeParameters = false; int bufPos = 0; @@ -745,6 +746,9 @@ IsoPresentation_parseConnect(IsoPresentation* self, ByteBuffer* byteBuffer) printf("PRES: error parsing normal-mode-parameters\n"); return 0; } + else { + hasNormalModeParameters = true; + } break; case 0x00: /* indefinite length end tag -> ignore */ @@ -757,6 +761,13 @@ IsoPresentation_parseConnect(IsoPresentation* self, ByteBuffer* byteBuffer) } } + if (hasNormalModeParameters == false) { + if (DEBUG_PRES) + printf("PRES: error - normal mode parameters are missing\n"); + + return 0; + } + return 1; }