I added lines to ensure that clients can create association only with the specified values for TSelector, PSelector and SSelector

pull/413/head
A-Bazhdar 3 years ago
parent 4b5db538fd
commit ffd6937e2b

@ -466,9 +466,14 @@ parseOptions(CotpConnection* self, uint8_t* buffer, int bufLen)
if (optionLen < 5) { if (optionLen < 5) {
self->options.tSelDst.size = optionLen; self->options.tSelDst.size = optionLen;
const uint8_t TransportSelectorConstValue[4] = {0,1,0,0};
int i; int i;
for (i = 0; i < optionLen; i++) for (i = 0; i < optionLen; i++)
{
self->options.tSelDst.value[i] = buffer[bufPos++]; self->options.tSelDst.value[i] = buffer[bufPos++];
if(TransportSelectorConstValue[i] != self->options.tSelDst.value[i])
return false;
}
} }
else else
goto cpo_error; goto cpo_error;

@ -447,9 +447,14 @@ parseNormalModeParameters(IsoPresentation* self, uint8_t* buffer, int totalLengt
} }
else { else {
self->calledPresentationSelector.size = len; self->calledPresentationSelector.size = len;
const uint8_t PresentationSelectorConstValue[16] = {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0};
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
{
self->calledPresentationSelector.value[i] = buffer[bufPos + i]; self->calledPresentationSelector.value[i] = buffer[bufPos + i];
if(PresentationSelectorConstValue[i] != self->calledPresentationSelector.value[i])
return -1;
}
} }
bufPos += len; bufPos += len;

@ -187,9 +187,14 @@ parseSessionHeaderParameters(IsoSession* session, ByteBuffer* message, int param
{ {
session->calledSessionSelector.size = parameterLength; session->calledSessionSelector.size = parameterLength;
const uint8_t SessionSelectorConstValue[16] = {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int i; int i;
for (i = 0; i < session->calledSessionSelector.size; i++) for (i = 0; i < session->calledSessionSelector.size; i++)
{
session->calledSessionSelector.value[i] = message->buffer[offset++]; session->calledSessionSelector.value[i] = message->buffer[offset++];
if(SessionSelectorConstValue[i] != session->calledSessionSelector.value[i])
return SESSION_ERROR;
}
} }
break; break;

Loading…
Cancel
Save