Skip to content

Commit fc51de2

Browse files
authored
Merge pull request #1786 from DSheirer/1783-l3h-p2-talker-alias-part-2
#1783 L3H P25P2 Talker Alias Guard Against Negative Length Aliases
2 parents 87ce08e + e1e7571 commit fc51de2

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22
# ******************************************************************************
3-
# Copyright (C) 2014-2023 Dennis Sheirer
3+
# Copyright (C) 2014-2024 Dennis Sheirer
44
#
55
# This program is free software: you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License as published by
@@ -28,4 +28,4 @@
2828
# tag name, specifically the dashes inserted before and after the alpha/beta labels.
2929
# See: https://github.com/DSheirer/sdrtrunk/issues/1651
3030

31-
projectVersion=0.6.0
31+
projectVersion=0.7.0-alpha-1

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,21 @@ public P25TalkerAliasIdentifier getAlias()
7878
{
7979
if(mAliasIdentifier == null)
8080
{
81-
int length = getLength() * 8 + getOffset();
81+
int length = getLength();
8282

83-
if(length > getMessage().size())
83+
if(length > 0)
8484
{
85-
length = getMessage().size();
86-
}
85+
length *= 8;
86+
length += getOffset();
87+
88+
if(length > getMessage().size())
89+
{
90+
length = getMessage().size();
91+
}
8792

88-
String alias = new String(getMessage().getSubMessage(ALIAS_START + getOffset(), length).getBytes()).trim();
89-
mAliasIdentifier = P25TalkerAliasIdentifier.create(alias);
93+
String alias = new String(getMessage().getSubMessage(ALIAS_START + getOffset(), length).getBytes()).trim();
94+
mAliasIdentifier = P25TalkerAliasIdentifier.create(alias);
95+
}
9096
}
9197

9298
return mAliasIdentifier;

0 commit comments

Comments
 (0)