From 6373eaadaec51f35a277fa3bea2db4491af4c9df Mon Sep 17 00:00:00 2001
From: Julian Dieskau <julian.dieskau@garz-fricke.com>
Date: Tue, 18 May 2021 21:32:08 +0200
Subject: [PATCH] Potential Segmentation Fault fixed

If I see it right there could be a segmentation fault if used in echo mode. When you choose echo mode the variable message wouldn't a value assigned and in the cleanup function the not allocated memory would be free'ed.
---
 testcases/rs485echo/rs485echo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/rs485echo/rs485echo.c b/testcases/rs485echo/rs485echo.c
index 9d1a7f8..b644049 100644
--- a/testcases/rs485echo/rs485echo.c
+++ b/testcases/rs485echo/rs485echo.c
@@ -95,7 +95,7 @@ int  fd;                             /* Handle for open serial port           */
 char* device_name = "/dev/ttymxc2";  /* String containing the device name     */
 struct termios termios;              /* termios structure for serial port     */
 int bytes = 8;                       /* Number of bytes to be sent            */
-struct message *message;             /* Message to be sent                    */
+struct message *message = NULL;      /* Message to be sent                    */
 int size_of_message;                 /* Size of message                       */
 char* received_data = NULL;          /* Received string                       */
 int repetitions = 1;                 /* Number of repetitions                 */
-- 
GitLab