Fix segfaults with malformed input and wrong command line arguments

Fixes:
NULL dereference.

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

Wyświetl plik

@ -1161,7 +1161,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

@ -1544,7 +1544,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

@ -1221,7 +1221,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);