Skip to content

Commit 14a7b04

Browse files
DSheirerDennis Sheirer
andauthored
#1931 Resolves issue where P25 Phase 2 L3Harris Patch Group message incorrectly includes Talkgroup/Radio identifiers incorrectly parsed from the subsequent message. Updated code to respect the self-reported message octet length and also to test for correct length before adding patch group member talkgroup and radio identifiers. (#1932)
Co-authored-by: Dennis Sheirer <[email protected]>
1 parent 2af3e99 commit 14a7b04

File tree

4 files changed

+66
-46
lines changed

4 files changed

+66
-46
lines changed

src/main/java/io/github/dsheirer/module/decode/p25/phase2/message/mac/MacMessageFactory.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,6 @@ public static MacStructure createMacStructure(CorrectedBinaryMessage message, in
566566
case L3HARRIS_A0_PRIVATE_DATA_CHANNEL_GRANT:
567567
return new L3HarrisPrivateDataChannelGrant(message, offset);
568568
case L3HARRIS_AA_GPS_LOCATION:
569-
L3HarrisTalkerGpsLocation gps = new L3HarrisTalkerGpsLocation(message, offset);
570-
mLog.info(gps.toString());
571569
return new L3HarrisTalkerGpsLocation(message, offset);
572570
case L3HARRIS_A8_TALKER_ALIAS:
573571
return new L3HarrisTalkerAlias(message, offset);

src/main/java/io/github/dsheirer/module/decode/p25/phase2/message/mac/MacOpcode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public enum MacOpcode
111111
L3HARRIS_A8_TALKER_ALIAS(Vendor.HARRIS, 168, "L3HARRIS TALKER ALIAS", -1),
112112
L3HARRIS_AA_GPS_LOCATION(Vendor.HARRIS, 170, "L3HARRIS GPS LOCATION", 17),
113113
L3HARRIS_AC_UNIT_TO_UNIT_DATA_CHANNEL_GRANT(Vendor.HARRIS, 172, "L3HARRIS UNIT-2-UNIT DATA CHANNEL GRANT", 12),
114-
L3HARRIS_B0_GROUP_REGROUP_EXPLICIT_ENCRYPTION_COMMAND(Vendor.HARRIS, 176, "L3HARRIS GROUP REGROUP EXPLICIT ENCRYPTION COMMAND", 17),//Variable length, but 17 in practice
114+
L3HARRIS_B0_GROUP_REGROUP_EXPLICIT_ENCRYPTION_COMMAND(Vendor.HARRIS, 176, "L3HARRIS GROUP REGROUP EXPLICIT ENCRYPTION COMMAND", Integer.MIN_VALUE),
115115

116116
MOTOROLA_80_GROUP_REGROUP_VOICE_CHANNEL_USER_ABBREVIATED(Vendor.MOTOROLA, 128, "MOTOROLA GROUP REGROUP VOICE CHANNEL USER ABBREVIATED", 8),
117117
MOTOROLA_81_GROUP_REGROUP_ADD(Vendor.MOTOROLA, 129, "MOTOROLA GROUP REGROUP ADD", 17),

src/main/java/io/github/dsheirer/module/decode/p25/phase2/message/mac/structure/l3harris/L3HarrisGroupRegroupExplicitEncryptionCommand.java

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ public String toString()
123123
sb.append(" V").append(getRegroupOptions().getSupergroupSequenceNumber());
124124
}
125125

126-
sb.append(" MSG LENGTH:").append(getLength());
127-
128126
return sb.toString();
129127
}
130128

@@ -175,58 +173,81 @@ public PatchGroupIdentifier getPatchGroup()
175173
{
176174
if(mPatchGroupIdentifier == null)
177175
{
176+
int octetLength = getLength();
177+
178178
TalkgroupIdentifier patchGroupId = APCO25Talkgroup.create(getInt(SUPERGROUP_ADDRESS));
179179
PatchGroup patchGroup = new PatchGroup(patchGroupId, getRegroupOptions().getSupergroupSequenceNumber());
180180

181181
if(getRegroupOptions().isTalkgroupAddress())
182182
{
183-
int talkgroup1 = getInt(TALKGROUP_1);
184-
185-
if(talkgroup1 > 0)
183+
if(octetLength >= 11)
186184
{
187-
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup1));
188-
189-
int talkgroup2 = getMessage().getInt(TALKGROUP_2, getOffset());
185+
int talkgroup1 = getInt(TALKGROUP_1);
190186

191-
if(talkgroup2 > 0)
187+
if(talkgroup1 > 0)
192188
{
193-
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup2));
189+
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup1));
194190

195-
int talkgroup3 = getMessage().getInt(TALKGROUP_3, getOffset());
196-
197-
if(talkgroup3 > 0)
191+
if(octetLength >= 13)
198192
{
199-
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup3));
200-
201-
int talkgroup4 = getMessage().getInt(TALKGROUP_4, getOffset());
193+
int talkgroup2 = getMessage().getInt(TALKGROUP_2, getOffset());
202194

203-
if(talkgroup4 > 0)
195+
if(talkgroup2 > 0)
204196
{
205-
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup4));
197+
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup2));
198+
199+
if(octetLength >= 15)
200+
{
201+
int talkgroup3 = getMessage().getInt(TALKGROUP_3, getOffset());
202+
203+
if(talkgroup3 > 0)
204+
{
205+
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup3));
206+
207+
if(octetLength >= 17)
208+
{
209+
int talkgroup4 = getMessage().getInt(TALKGROUP_4, getOffset());
210+
211+
if(talkgroup4 > 0)
212+
{
213+
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup4));
214+
}
215+
}
216+
}
217+
}
206218
}
207219
}
208220
}
209221
}
210222
}
211223
else
212224
{
213-
int radio1 = getInt(RADIO_1);
214-
215-
if(radio1 > 0)
225+
if(octetLength >= 11)
216226
{
217-
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio1));
227+
int radio1 = getInt(RADIO_1);
218228

219-
int radio2 = getInt(RADIO_2);
220-
221-
if(radio2 > 0)
229+
if(radio1 > 0)
222230
{
223-
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio2));
224-
225-
int radio3 = getInt(RADIO_3);
231+
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio1));
226232

227-
if(radio3 > 0)
233+
if(octetLength >= 14)
228234
{
229-
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio3));
235+
int radio2 = getInt(RADIO_2);
236+
237+
if(radio2 > 0)
238+
{
239+
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio2));
240+
241+
if(octetLength >= 17)
242+
{
243+
int radio3 = getInt(RADIO_3);
244+
245+
if(radio3 > 0)
246+
{
247+
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio3));
248+
}
249+
}
250+
}
230251
}
231252
}
232253
}

src/main/java/io/github/dsheirer/source/tuner/frequency/FrequencyController.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@
2222
import io.github.dsheirer.source.InvalidFrequencyException;
2323
import io.github.dsheirer.source.SourceEvent;
2424
import io.github.dsheirer.source.SourceException;
25-
import org.slf4j.Logger;
26-
import org.slf4j.LoggerFactory;
27-
2825
import java.util.ArrayList;
2926
import java.util.List;
3027
import java.util.concurrent.locks.ReentrantLock;
28+
import org.slf4j.Logger;
29+
import org.slf4j.LoggerFactory;
3130

3231
public class FrequencyController
3332
{
@@ -341,22 +340,24 @@ protected void broadcastSampleRateChange() throws SourceException
341340

342341
public void broadcast(SourceEvent event) throws SourceException
343342
{
344-
mTunable.getLock().lock();
345-
346-
try
343+
if(mTunable != null)
347344
{
348-
for(ISourceEventProcessor processor : mProcessors)
345+
mTunable.getLock().lock();
346+
347+
try
349348
{
350-
processor.process(event);
349+
for(ISourceEventProcessor processor : mProcessors)
350+
{
351+
processor.process(event);
352+
}
353+
}
354+
finally
355+
{
356+
mTunable.getLock().unlock();
351357
}
352-
}
353-
finally
354-
{
355-
mTunable.getLock().unlock();
356358
}
357359
}
358360

359-
360361
public interface Tunable
361362
{
362363
/**

0 commit comments

Comments
 (0)