gui: Discard overlong input lines.
[paraslash.git] / gui.c
diff --git a/gui.c b/gui.c
index a4ee727..728fb9b 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -951,7 +951,7 @@ static int open_stat_pipe(void)
        return ret;
 }
 
-#define COMMAND_BUF_SIZE 4096
+#define COMMAND_BUF_SIZE 32768
 
 /*
  * This is the core select loop. Besides the (internal) signal
@@ -1023,6 +1023,10 @@ repeat:
                                if (command_fds[!i] < 0) /* both fds closed */
                                        return 0;
                        }
+                       if (cbo[i] == COMMAND_BUF_SIZE - 1) {
+                               PARA_NOTICE_LOG("discarding overlong line");
+                               cbo[i] = 0;
+                       }
                }
        }
        ret = read_stat_pipe(&rfds);