Description: avoid buffer overflow
Author: Andreas Beckmann <anbe@debian.org>

--- trueprint-5.4.orig/src/output.c
+++ trueprint-5.4/src/output.c
@@ -124,8 +124,11 @@ void
 add_char(short position,char character,char_status status,char *line,char_status line_status[])
 
 {
-  if (position >= MAXLINELENGTH)
+  if (position >= MAXLINELENGTH-1)
+  {
     fprintf(stderr, gettext(CMD_NAME ": line too long!  Are you sure this is a program listing?\n"));
+    return;
+  }
   line[position] = character;
   line_status[position] = status;
 }
@@ -206,6 +209,8 @@ getnextline(stream_status (*get_input_ch
   /*
    * put a null at the end of the line
    */
+  if (line_position >= MAXLINELENGTH-1)
+	  line_position = MAXLINELENGTH-1;
   input_line[line_position] = 0;
 
   return(retval);
