Project

General

Profile

« Previous | Next » 

Revision 89879a09

Added by osmith about 4 years ago

IMSIPseudo.java: fix up length somewhat

Since it is counting nibbles, we need to take the length, which is in
bytes, two times. Also increase the size of the whole string, because
there are additional numbers infront of the imsi, it seems.

There are still two numbers missing at the end, and there is a
mysterious ) character. But other than that, it's working.

View differences:

sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java
103 103
		/* 3GPP TS 31.102 4.2.2: IMSI */
104 104
		byte[] IMSI = new byte[9];
105 105
		byte[] msg = {'C', 'u', 'r', 'r', 'e', 'n', 't', ' ', 'I', 'M', 'S', 'I', ':', ' ',
106
			      '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'};
106
			      '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'};
107 107

  
108 108
		gsmFile.select((short) SIMView.FID_DF_GSM);
109 109
		gsmFile.select((short) SIMView.FID_EF_IMSI);
......
114 114
			showError(e.getReason());
115 115
			return;
116 116
		}
117
		byte len = (byte) (IMSI[0] * 2);
117 118

  
118
		for (byte i = (byte)0; i < (byte)15; i++) {
119
		for (byte i = (byte)0; i < (byte)18; i++) {
119 120
			byte msg_i = (byte)(14 + i);
120
			if (i >= IMSI[0]) {
121
			if (i >= len) {
121 122
				msg[msg_i] = ' ';
122 123
			} else if (i % (byte)2 == (byte)0) {
123 124
				msg[msg_i] = (byte)('0' + (IMSI[i / (byte)2] & 0x0f));

Also available in: Unified diff

Add picture from clipboard (Maximum size: 48.8 MB)