#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: case L3HARRIS_A0_PRIVATE_DATA_CHANNEL_GRANT:
return new L3HarrisPrivateDataChannelGrant(message, offset); return new L3HarrisPrivateDataChannelGrant(message, offset);
case L3HARRIS_AA_GPS_LOCATION: case L3HARRIS_AA_GPS_LOCATION:
L3HarrisTalkerGpsLocation gps = new L3HarrisTalkerGpsLocation(message, offset);
mLog.info(gps.toString());
return new L3HarrisTalkerGpsLocation(message, offset); return new L3HarrisTalkerGpsLocation(message, offset);
case L3HARRIS_A8_TALKER_ALIAS: case L3HARRIS_A8_TALKER_ALIAS:
return new L3HarrisTalkerAlias(message, offset); 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_A8_TALKER_ALIAS(Vendor.HARRIS, 168, "L3HARRIS TALKER ALIAS", -1),
L3HARRIS_AA_GPS_LOCATION(Vendor.HARRIS, 170, "L3HARRIS GPS LOCATION", 17), 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_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_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), 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(" V").append(getRegroupOptions().getSupergroupSequenceNumber());
} }
sb.append(" MSG LENGTH:").append(getLength());
return sb.toString(); return sb.toString();
} }
@@ -175,10 +173,14 @@ public class L3HarrisGroupRegroupExplicitEncryptionCommand extends MacStructureV
{ {
if(mPatchGroupIdentifier == null) if(mPatchGroupIdentifier == null)
{ {
int octetLength = getLength();
TalkgroupIdentifier patchGroupId = APCO25Talkgroup.create(getInt(SUPERGROUP_ADDRESS)); TalkgroupIdentifier patchGroupId = APCO25Talkgroup.create(getInt(SUPERGROUP_ADDRESS));
PatchGroup patchGroup = new PatchGroup(patchGroupId, getRegroupOptions().getSupergroupSequenceNumber()); PatchGroup patchGroup = new PatchGroup(patchGroupId, getRegroupOptions().getSupergroupSequenceNumber());
if(getRegroupOptions().isTalkgroupAddress()) if(getRegroupOptions().isTalkgroupAddress())
{
if(octetLength >= 11)
{ {
int talkgroup1 = getInt(TALKGROUP_1); int talkgroup1 = getInt(TALKGROUP_1);
@@ -186,18 +188,24 @@ public class L3HarrisGroupRegroupExplicitEncryptionCommand extends MacStructureV
{ {
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup1)); patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup1));
if(octetLength >= 13)
{
int talkgroup2 = getMessage().getInt(TALKGROUP_2, getOffset()); int talkgroup2 = getMessage().getInt(TALKGROUP_2, getOffset());
if(talkgroup2 > 0) if(talkgroup2 > 0)
{ {
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup2)); patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup2));
if(octetLength >= 15)
{
int talkgroup3 = getMessage().getInt(TALKGROUP_3, getOffset()); int talkgroup3 = getMessage().getInt(TALKGROUP_3, getOffset());
if(talkgroup3 > 0) if(talkgroup3 > 0)
{ {
patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup3)); patchGroup.addPatchedTalkgroup(APCO25Talkgroup.create(talkgroup3));
if(octetLength >= 17)
{
int talkgroup4 = getMessage().getInt(TALKGROUP_4, getOffset()); int talkgroup4 = getMessage().getInt(TALKGROUP_4, getOffset());
if(talkgroup4 > 0) if(talkgroup4 > 0)
@@ -208,7 +216,13 @@ public class L3HarrisGroupRegroupExplicitEncryptionCommand extends MacStructureV
} }
} }
} }
}
}
}
}
else else
{
if(octetLength >= 11)
{ {
int radio1 = getInt(RADIO_1); int radio1 = getInt(RADIO_1);
@@ -216,12 +230,16 @@ public class L3HarrisGroupRegroupExplicitEncryptionCommand extends MacStructureV
{ {
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio1)); patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio1));
if(octetLength >= 14)
{
int radio2 = getInt(RADIO_2); int radio2 = getInt(RADIO_2);
if(radio2 > 0) if(radio2 > 0)
{ {
patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio2)); patchGroup.addPatchedRadio(APCO25RadioIdentifier.createTo(radio2));
if(octetLength >= 17)
{
int radio3 = getInt(RADIO_3); int radio3 = getInt(RADIO_3);
if(radio3 > 0) if(radio3 > 0)
@@ -231,6 +249,9 @@ public class L3HarrisGroupRegroupExplicitEncryptionCommand extends MacStructureV
} }
} }
} }
}
}
}
mPatchGroupIdentifier = APCO25PatchGroup.create(patchGroup); mPatchGroupIdentifier = APCO25PatchGroup.create(patchGroup);
} }

View File

@@ -22,12 +22,11 @@ import io.github.dsheirer.source.ISourceEventProcessor;
import io.github.dsheirer.source.InvalidFrequencyException; import io.github.dsheirer.source.InvalidFrequencyException;
import io.github.dsheirer.source.SourceEvent; import io.github.dsheirer.source.SourceEvent;
import io.github.dsheirer.source.SourceException; import io.github.dsheirer.source.SourceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FrequencyController public class FrequencyController
{ {
@@ -340,6 +339,8 @@ public class FrequencyController
} }
public void broadcast(SourceEvent event) throws SourceException public void broadcast(SourceEvent event) throws SourceException
{
if(mTunable != null)
{ {
mTunable.getLock().lock(); mTunable.getLock().lock();
@@ -355,7 +356,7 @@ public class FrequencyController
mTunable.getLock().unlock(); mTunable.getLock().unlock();
} }
} }
}
public interface Tunable public interface Tunable
{ {