Merge pull request #1784 from DSheirer/1783-l3h-p2-message-parse-error

#1783 P25P2 L3Harris Talker Alias Index Out Of Bounds Exception
This commit is contained in:
Denny Sheirer
2024-01-08 03:58:17 -05:00
committed by GitHub

View File

@@ -1,6 +1,6 @@
/* /*
* ***************************************************************************** * *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer * Copyright (C) 2014-2024 Dennis Sheirer
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -78,8 +78,14 @@ public class L3HarrisTalkerAlias extends MacStructure
{ {
if(mAliasIdentifier == null) if(mAliasIdentifier == null)
{ {
int length = getLength() * 8; int length = getLength() * 8 + getOffset();
String alias = new String(getMessage().getSubMessage(ALIAS_START + getOffset(), length + getOffset()).getBytes()).trim();
if(length > getMessage().size())
{
length = getMessage().size();
}
String alias = new String(getMessage().getSubMessage(ALIAS_START + getOffset(), length).getBytes()).trim();
mAliasIdentifier = P25TalkerAliasIdentifier.create(alias); mAliasIdentifier = P25TalkerAliasIdentifier.create(alias);
} }