Fix segfaults with malformed input and wrong command line arguments

Fixes:
NULL dereference.

Steps to reproduce:
echo L | tests/ampctl
echo L | tests/rigctl
echo L | tests/rotctl
pull/1270/head
Daniele Forsi IU5HKX 2023-04-10 09:15:12 +02:00
rodzic 6c1d83ed86
commit e11b4bd01c
3 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -1100,7 +1100,7 @@ int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
rp_getline(pmptstr);
if (!(strcmp(input_line, "")))
if (!input_line || !(strcmp(input_line, "")))
{
fprintf(fout, "? for help, q to quit.\n");
fflush(fout);

Wyświetl plik

@ -1478,7 +1478,7 @@ readline_repeat:
rp_getline(pmptstr);
if (!(strcmp(input_line, "")))
if (!input_line || !(strcmp(input_line, "")))
{
fprintf(fout, "? for help, q to quit.\n");
fflush(fout);

Wyświetl plik

@ -1160,7 +1160,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc,
rp_getline(pmptstr);
if (!(strcmp(input_line, "")))
if (!input_line || !(strcmp(input_line, "")))
{
fprintf(fout, "? for help, q to quit.\n");
fflush(fout);