#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 <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2024-06-01 06:38:38 -04:00
committed by GitHub
parent 2af3e992a1
commit 14a7b040f9
4 changed files with 66 additions and 46 deletions

View File

@@ -566,8 +566,6 @@ public class MacMessageFactory
case L3HARRIS_A0_PRIVATE_DATA_CHANNEL_GRANT:
return new L3HarrisPrivateDataChannelGrant(message, offset);
case L3HARRIS_AA_GPS_LOCATION:
L3HarrisTalkerGpsLocation gps = new L3HarrisTalkerGpsLocation(message, offset);
mLog.info(gps.toString());
return new L3HarrisTalkerGpsLocation(message, offset);
case L3HARRIS_A8_TALKER_ALIAS:
return new L3HarrisTalkerAlias(message, offset);

View File

@@ -111,7 +111,7 @@ public enum MacOpcode
L3HARRIS_A8_TALKER_ALIAS(Vendor.HARRIS, 168, "L3HARRIS TALKER ALIAS", -1),
L3HARRIS_AA_GPS_LOCATION(Vendor.HARRIS, 170, "L3HARRIS GPS LOCATION", 17),
L3HARRIS_AC_UNIT_TO_UNIT_DATA_CHANNEL_GRANT(Vendor.HARRIS, 172, "L3HARRIS UNIT-2-UNIT DATA CHANNEL GRANT", 12),
L3HARRIS_B0_GROUP_REGROUP_EXPLICIT_ENCRYPTION_COMMAND(Vendor.HARRIS, 176, "L3HARRIS GROUP REGROUP EXPLICIT ENCRYPTION COMMAND", 17),//Variable length, but 17 in practice
L3HARRIS_B0_GROUP_REGROUP_EXPLICIT_ENCRYPTION_COMMAND(Vendor.HARRIS, 176, "L3HARRIS GROUP REGROUP EXPLICIT ENCRYPTION COMMAND", Integer.MIN_VALUE),
MOTOROLA_80_GROUP_REGROUP_VOICE_CHANNEL_USER_ABBREVIATED(Vendor.MOTOROLA, 128, "MOTOROLA GROUP REGROUP VOICE CHANNEL USER ABBREVIATED", 8),
MOTOROLA_81_GROUP_REGROUP_ADD(Vendor.MOTOROLA, 129, "MOTOROLA GROUP REGROUP ADD", 17),

View File

@@ -123,8 +123,6 @@ public class L3HarrisGroupRegroupExplicitEncryptionCommand extends MacStructureV
sb.append(" V").append(getRegroupOptions().getSupergroupSequenceNumber());
}
sb.append(" MSG LENGTH:").append(getLength());
return sb.toString();
}
@@ -175,34 +173,48 @@ public class L3HarrisGroupRegroupExplicitEncryptionCommand extends MacStructureV
{
if(mPatchGroupIdentifier == null)
{
int octetLength = getLength();
TalkgroupIdentifier patchGroupId = APCO25Talkgroup.create(getInt(SUPERGROUP_ADDRESS));
PatchGroup patchGroup = new PatchGroup(patchGroupId, getRegroupOptions().getSupergroupSequenceNumber());
if(getRegroupOptions().isTalkgroupAddress())
{
int talkgroup1 = getInt(TALKGROUP_1);
if(talkgroup1 > 0)
if(octetLength >= 11)
{
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup1));
int talkgroup1 = getInt(TALKGROUP_1);
int talkgroup2 = getMessage().getInt(TALKGROUP_2, getOffset());
if(talkgroup2 > 0)
if(talkgroup1 > 0)
{
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup2));
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup1));
int talkgroup3 = getMessage().getInt(TALKGROUP_3, getOffset());
if(talkgroup3 > 0)
if(octetLength >= 13)
{
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup3));
int talkgroup2 = getMessage().getInt(TALKGROUP_2, getOffset());
int talkgroup4 = getMessage().getInt(TALKGROUP_4, getOffset());
if(talkgroup4 > 0)
if(talkgroup2 > 0)
{
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup4));
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup2));
if(octetLength >= 15)
{
int talkgroup3 = getMessage().getInt(TALKGROUP_3, getOffset());
if(talkgroup3 > 0)
{
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup3));
if(octetLength >= 17)
{
int talkgroup4 = getMessage().getInt(TALKGROUP_4, getOffset());
if(talkgroup4 > 0)
{
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup4));
}
}
}
}
}
}
}
@@ -210,23 +222,32 @@ public class L3HarrisGroupRegroupExplicitEncryptionCommand extends MacStructureV
}
else
{
int radio1 = getInt(RADIO_1);
if(radio1 > 0)
if(octetLength >= 11)
{
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio1));
int radio1 = getInt(RADIO_1);
int radio2 = getInt(RADIO_2);
if(radio2 > 0)
if(radio1 > 0)
{
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio2));
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio1));
int radio3 = getInt(RADIO_3);
if(radio3 > 0)
if(octetLength >= 14)
{
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio3));
int radio2 = getInt(RADIO_2);
if(radio2 > 0)
{
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio2));
if(octetLength >= 17)
{
int radio3 = getInt(RADIO_3);
if(radio3 > 0)
{
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio3));
}
}
}
}
}
}

View File

@@ -22,12 +22,11 @@ import io.github.dsheirer.source.ISourceEventProcessor;
import io.github.dsheirer.source.InvalidFrequencyException;
import io.github.dsheirer.source.SourceEvent;
import io.github.dsheirer.source.SourceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FrequencyController
{
@@ -341,22 +340,24 @@ public class FrequencyController
public void broadcast(SourceEvent event) throws SourceException
{
mTunable.getLock().lock();
try
if(mTunable != null)
{
for(ISourceEventProcessor processor : mProcessors)
mTunable.getLock().lock();
try
{
processor.process(event);
for(ISourceEventProcessor processor : mProcessors)
{
processor.process(event);
}
}
finally
{
mTunable.getLock().unlock();
}
}
finally
{
mTunable.getLock().unlock();
}
}
public interface Tunable
{
/**