diff '--color=auto' -uNr work.orig/client.c work/client.c --- work.orig/client.c 2026-04-07 19:20:30.733614568 +0200 +++ work/client.c 2026-04-07 19:35:35.503638919 +0200 @@ -95,6 +95,32 @@ #define VERSION "6.01.16" +static int read_string(char *buf, size_t len) +{ + if (scanf("%254s", buf) != 1) { + if (len) buf[0] = 0; + return 0; + } + return 1; +} + +static int read_int(int *value) +{ + if (scanf("%d", value) != 1) { + *value = 0; + return 0; + } + return 1; +} + +static int read_line(char *buf, size_t len) +{ + if (!fgets(buf, len, stdin)) { + if (len) buf[0] = 0; + return 0; + } + return 1; +} int main (int argc,char *argv[]) { @@ -585,7 +611,7 @@ NETWORKSTATUS stat; BuildSendMenu (); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -593,40 +619,40 @@ case 1: printf ("\nEnter Remote Name: "); fflush (stdout); - scanf ("%s",send_remote); + read_string(send_remote, sizeof(send_remote)); getchar (); break; case 2: printf ("\nCommand Name: "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); NetworkCommand (COMMAND_SEND,send_remote,st,0,0,&stat); break; case 3: printf ("\nLCD Text: "); fflush (stdout); - fgets (st,sizeof (st),stdin); + read_line(st, sizeof(st)); NetworkCommand (COMMAND_LCD,st,0,LCD_TEXT | LCD_BACKLIGHT,'L',&stat); break; case 4: printf ("\nLCD Init Text Line 1: "); fflush (stdout); - fgets (st,sizeof (st),stdin); + read_line(st, sizeof(st)); printf ("\nLCD Init Text Line 2: "); fflush (stdout); - fgets (l2,sizeof (l2),stdin); + read_line(l2, sizeof(l2)); strcat (st,l2); NetworkCommand (COMMAND_LCDINIT,st,0,LCD_TEXT,'L',&stat); break; case 5: printf ("\nSwitch Number: "); fflush (stdout); - scanf ("%d",&sw); + read_int(&sw); getchar (); printf ("\nSwitch Value: "); fflush (stdout); - scanf ("%d",&md); + read_int(&md); getchar (); st[0] = sw; st[1] = md; @@ -647,7 +673,7 @@ NETWORKSTATUS stat; BuildLearnMenu (); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -656,7 +682,7 @@ if (*learn_remote) NetworkCommand (COMMAND_CLOSE,learn_remote,st,0,'L',&stat); printf ("\nEnter Remote Name: "); fflush (stdout); - scanf ("%s",learn_remote); + if (scanf("%99s", learn_remote) != 1) learn_remote[0] = 0; getchar (); NetworkCommand (COMMAND_LRNREM,learn_remote,st,0,'L',&stat); break; @@ -670,7 +696,7 @@ case 3: printf ("\nCommand Name: "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); printf ("\nPress Remote Button to learn ...."); fflush (stdout); @@ -681,7 +707,7 @@ case 4: printf ("\nCommand Name: "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); printf ("\nPress Remote Button to learn ...."); fflush (stdout); @@ -692,7 +718,7 @@ case 5: printf ("\nCommand Name: "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); printf ("\nPress Remote Button to learn ...."); fflush (stdout); @@ -1108,7 +1134,7 @@ printf ("\nSelect command "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1161,7 +1187,7 @@ printf ("\nSelect command "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1213,7 +1239,7 @@ printf ("\nSelect command "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1233,7 +1259,7 @@ printf ("\nSelect command "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1285,7 +1311,7 @@ printf ("\nSelect command "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1307,7 +1333,7 @@ printf ("\nSelect command "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1350,7 +1376,7 @@ printf ("\nSelect command "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1390,7 +1416,7 @@ printf ("\nSelect command "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1404,7 +1430,7 @@ char st[255]; int choice,sel; - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1508,7 +1534,7 @@ printf ("\n\nEnter PowerOn Remote: "); fflush (stdout); memset (st,0,255); - fgets (st,255,stdin); + if (!fgets(st, 255, stdin)) st[0] = 0; while (st[strlen (st) - 1] == 10 || st[strlen (st) - 1] == 13) st[strlen (st) - 1] = 0; memcpy (status->stat[bus][adr].remote,st,80); @@ -1517,7 +1543,7 @@ printf ("\n\nEnter PowerOn Command: "); fflush (stdout); memset (st,0,255); - fgets (st,255,stdin); + if (!fgets(st, 255, stdin)) st[0] = 0; while (st[strlen (st) - 1] == 10 || st[strlen (st) - 1] == 13) st[strlen (st) - 1] = 0; memcpy (status->stat[bus][adr].command,st,20); @@ -1526,7 +1552,7 @@ printf ("\n\nEnter PowerOff Remote: "); fflush (stdout); memset (st,0,255); - fgets (st,255,stdin); + if (!fgets(st, 255, stdin)) st[0] = 0; while (st[strlen (st) - 1] == 10 || st[strlen (st) - 1] == 13) st[strlen (st) - 1] = 0; memcpy (status->stat[bus][adr].remote2,st,80); @@ -1535,7 +1561,7 @@ printf ("\n\nEnter PowerOff Command: "); fflush (stdout); memset (st,0,255); - fgets (st,255,stdin); + if (!fgets(st, 255, stdin)) st[0] = 0; while (st[strlen (st) - 1] == 10 || st[strlen (st) - 1] == 13) st[strlen (st) - 1] = 0; memcpy (status->stat[bus][adr].command2,st,20); @@ -1544,7 +1570,7 @@ printf ("\n\nEnter MAC Address: "); fflush (stdout); memset (st,0,255); - fgets (st,255,stdin); + if (!fgets(st, 255, stdin)) st[0] = 0; while (st[strlen (st) - 1] == 10 || st[strlen (st) - 1] == 13) st[strlen (st) - 1] = 0; if (st[0] == 0 || st[1] == 0) { memset (status->stat[bus][adr].command2,0,6); @@ -1598,7 +1624,7 @@ printf ("\nSelect panel: "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); } @@ -1653,7 +1679,7 @@ while (choice < 56) { ShowSetStatus (adr,bus,status); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1682,25 +1708,29 @@ if (choice == 52) { printf ("\nEnter PowerOn Remote: "); fflush (stdout); - scanf ("%s",status->stat[bus][adr].remote); + if (scanf("%79s", status->stat[bus][adr].remote) != 1) + status->stat[bus][adr].remote[0] = 0; } if (choice == 53) { printf ("\nEnter PowerOn Command: "); fflush (stdout); - scanf ("%s",status->stat[bus][adr].command); + if (scanf("%19s", status->stat[bus][adr].command) != 1) + status->stat[bus][adr].command[0] = 0; } if (choice == 54) { printf ("\nEnter PowerOff Remote: "); fflush (stdout); - scanf ("%s",status->stat[bus][adr].remote2); + if (scanf("%79s", status->stat[bus][adr].remote2) != 1) + status->stat[bus][adr].remote2[0] = 0; } if (choice == 55) { printf ("\nEnter PowerOff Command: "); fflush (stdout); - scanf ("%s",status->stat[bus][adr].command2); + if (scanf("%19s", status->stat[bus][adr].command2) != 1) + status->stat[bus][adr].command2[0] = 0; } if (choice == 99) { @@ -1786,7 +1816,7 @@ printf ("\n99 - Exit\n"); printf ("\nSelect command "); fflush (stdout); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); @@ -1818,7 +1848,7 @@ int choice = 0; BuildMainMenu (); - scanf ("%s",st); + read_string(st, sizeof(st)); getchar (); choice = atoi (st); Binärdateien work.orig/ip_assign64 und work/ip_assign64 sind verschieden. diff '--color=auto' -uNr work.orig/ip_assign.c work/ip_assign.c --- work.orig/ip_assign.c 2026-04-07 19:20:30.733614568 +0200 +++ work/ip_assign.c 2026-04-07 19:30:48.216798431 +0200 @@ -206,7 +206,7 @@ printf ("Please select device to use (0 = Exit) "); fflush (stdout); do { - fgets (nm,sizeof (nm),stdin); + if (!fgets (nm,sizeof (nm),stdin)) nm[0] = 0; choice = atoi (nm); } while (nm[0] < '0'); @@ -309,7 +309,7 @@ printf ("\n\nConfigure device for DHCP (Y/N) ? "); fflush (stdout); - fgets (nm,sizeof (nm),stdin); + if (!fgets (nm,sizeof (nm),stdin)) nm[0] = 0; printf ("\n"); if (*nm == 'Y' || *nm == 'y') ip->dhcp_flag = 1; @@ -317,26 +317,26 @@ do { printf ("\nEnter IP Address: "); fflush (stdout); - fgets (nm,sizeof (nm),stdin); + if (!fgets (nm,sizeof (nm),stdin)) nm[0] = 0; ip->ip = inet_addr (nm); } while (ip->ip == INADDR_NONE); do { printf ("\nEnter Netmask : "); fflush (stdout); - fgets (nm,sizeof (nm),stdin); + if (!fgets (nm,sizeof (nm),stdin)) nm[0] = 0; ip->netmask = inet_addr (nm); } while (ip->netmask == INADDR_NONE); do { printf ("\nDefault Gateway : "); fflush (stdout); - fgets (nm,sizeof (nm),stdin); + if (!fgets (nm,sizeof (nm),stdin)) nm[0] = 0; ip->gateway = inet_addr (nm); } while (ip->gateway == INADDR_NONE); } printf ("\n\nEnter device password: "); fflush (stdout); - fgets (ip->password,8,stdin); + if (!fgets (ip->password,8,stdin)) ip->password[0] = 0; printf ("\n"); } Binärdateien work.orig/irclient64 und work/irclient64 sind verschieden. Binärdateien work.orig/x64/client.o und work/x64/client.o sind verschieden. Binärdateien work.orig/x64/ip_assign.o und work/x64/ip_assign.o sind verschieden.