From 8b883f556f7170ad2d6a211fa1e8019b143c5ec9 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Sat, 15 Jun 2024 01:18:47 -0400 Subject: [PATCH] M17: Packet Decode Fix Sanity Check So It Doesn't Break CRC; --- src/m17.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/m17.c b/src/m17.c index 4584f3d..c53371c 100644 --- a/src/m17.c +++ b/src/m17.c @@ -3379,9 +3379,12 @@ void processM17PKT(dsd_opts * opts, dsd_state * state) //sanity check to we don't go out of bounds on memcpy and total (core dump) if (ptr > 825) ptr = 825; if (ptr < 0) ptr = 0; - if (ptr == 0 && eot == 1) ptr = 3; //this is from a bad decode, and caused a core dump on total being a negative value int total = ptr + counter - 3; //-3 if changes to M17_Implementations are made + + //sanity check on total + if (total < 0 && eot == 1) total = 0; //this is from a bad decode, and caused a core dump on total being a negative value + int end = ptr + 25; //TODO: Fix this