Subj : Fixed Segfault bug in internal editor
To   : All
From : Niels Haedecke
Date : Wed Jan 31 2024 07:37 am


Hello, MBSE Developer Team,

I have found and fixed an error with the 'HelP' window shown in the internal
editor, which causes the editor to crash:

1.) Steps to reproduce:
   - Enter a message in the internal editor
- In the editor, press <ESC> and then <H> to display the help text window
- Press a key to close the help text window
- Try to continue to edit the message text
 -> an error message appears, then the BBS disconnects

2.) Root cause analysis:
   - The function "void Full_Help(void)" in fsedit.c utilizes several helper
 functions to draw the help-text window. These helper functions access and
 manipulate the gobal variables "int Col" and "int Row" causing an overflow
 of the "Row" variable. This overflow will lead to a Segfault when
"Refresh()"
 function is called before resuming editing of the text.

3.) Solution:
   - i've added tow local variables "int hc" and "int hr" to the function
 "void Full_Help(void)" which are being used to temporary store the original
 values if "int Col" and "int Row" at the beginning of the function before
 drawing the help-text window. Once this is drawn, "int Col" and "int Row"
are
 being assigned the original values temporarily stored in "int hc" and
 "int hr". That way, the call to "Refresh()" after drawing the help-text
 window will no longer crash and operate as intended.

Do you want me to create a MR for this fix?

Kind regards,
Niels

   Greetings, Niels Haedecke

--- MBSE BBS v1.0.8.4 (Linux-aarch64)
* Origin: Wintermute BBS - Duesseldorf, Germany (2:240/8002)