laforge
/
openbts-osmo
Archived
1
0
Fork 0

Fix parsing error for malformed mobile identity types.

This commit is contained in:
David A. Burgess 2010-07-02 18:18:00 -07:00
parent 98e0876b50
commit 35750c3d11
1 changed files with 23 additions and 23 deletions

View File

@ -28,6 +28,7 @@
#include <Logger.h>
#include "GSML3CommonElements.h"
@ -191,30 +192,29 @@ void L3MobileIdentity::parseV( const L3Frame& src, size_t &rp, size_t expectedLe
bool oddCount = (bool) src.readField(rp,1);
mType = (MobileIDType) src.readField(rp,3);
// No ID?
if (mType==NoIDType) {
mDigits[0]='\0';
return;
switch (mType) {
case TMSIType:
mDigits[0]='\0';
// GSM 03.03 2.4 tells us the TMSI is always 32 bits
mTMSI = src.readField(rp,32);
break;
case IMSIType:
case IMEISVType:
case IMEIType:
while (rp<endCount) {
unsigned tmp = src.readField(rp,4);
mDigits[numDigits++] = src.readField(rp,4)+'0';
mDigits[numDigits++] = tmp + '0';
if (numDigits>15) L3_READ_ERROR;
}
if (!oddCount) numDigits--;
mDigits[numDigits]='\0';
break;
default:
LOG(NOTICE) << "non-standard identity type " << (int)mType;
mDigits[0]='\0';
mType = NoIDType;
}
// TMSI?
if (mType==TMSIType) {
mDigits[0]='\0';
// GSM 03.03 2.4 tells us the TMSI is always 32 bits
mTMSI = src.readField(rp,32);
return;
}
// IMEI and IMSI.
while (rp<endCount) {
unsigned tmp = src.readField(rp,4);
mDigits[numDigits++] = src.readField(rp,4)+'0';
mDigits[numDigits++] = tmp + '0';
if (numDigits>15) L3_READ_ERROR;
}
if (!oddCount) numDigits--;
mDigits[numDigits]='\0';
}
void L3MobileIdentity::text(ostream& os) const