From e1e75710cb2ecb894d75bac93947facd2197099a Mon Sep 17 00:00:00 2001 From: Dennis Sheirer Date: Wed, 10 Jan 2024 02:45:01 -0500 Subject: [PATCH] #1783 L3H Talker Alias guard against negative length aliases --- gradle.properties | 4 ++-- .../l3harris/L3HarrisTalkerAlias.java | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index efff4a3a3..9abb0de64 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 # it under the terms of the GNU General Public License as published by @@ -28,4 +28,4 @@ # tag name, specifically the dashes inserted before and after the alpha/beta labels. # See: https://github.com/DSheirer/sdrtrunk/issues/1651 -projectVersion=0.6.0 \ No newline at end of file +projectVersion=0.7.0-alpha-1 \ No newline at end of file diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/phase2/message/mac/structure/l3harris/L3HarrisTalkerAlias.java b/src/main/java/io/github/dsheirer/module/decode/p25/phase2/message/mac/structure/l3harris/L3HarrisTalkerAlias.java index 09bb4eb51..a92e3bc68 100644 --- a/src/main/java/io/github/dsheirer/module/decode/p25/phase2/message/mac/structure/l3harris/L3HarrisTalkerAlias.java +++ b/src/main/java/io/github/dsheirer/module/decode/p25/phase2/message/mac/structure/l3harris/L3HarrisTalkerAlias.java @@ -78,15 +78,21 @@ public P25TalkerAliasIdentifier getAlias() { if(mAliasIdentifier == null) { - int length = getLength() * 8 + getOffset(); + int length = getLength(); - if(length > getMessage().size()) + if(length > 0) { - length = getMessage().size(); - } + length *= 8; + length += getOffset(); + + if(length > getMessage().size()) + { + length = getMessage().size(); + } - String alias = new String(getMessage().getSubMessage(ALIAS_START + getOffset(), length).getBytes()).trim(); - mAliasIdentifier = P25TalkerAliasIdentifier.create(alias); + String alias = new String(getMessage().getSubMessage(ALIAS_START + getOffset(), length).getBytes()).trim(); + mAliasIdentifier = P25TalkerAliasIdentifier.create(alias); + } } return mAliasIdentifier;