[readline] Fix heap-buffer-overflow in update_line
[deliverable/binutils-gdb.git] / readline / display.c
index 7653d8731974d9931c2f9aa698dc857a9a0108da..842adf5067f06130d98639878a5a38f08c54ac57 100644 (file)
@@ -450,6 +450,9 @@ init_line_structures (minsize)
 {
   register int n;
 
+  if (minsize <= _rl_screenwidth)      /* XXX - for gdb */
+    minsize = _rl_screenwidth + 1;
+
   if (invisible_line == 0)     /* initialize it */
     {
       if (line_size < minsize)
@@ -526,6 +529,8 @@ rl_redisplay ()
       init_line_structures (0);
       rl_on_new_line ();
     }
+  else if (line_size <= _rl_screenwidth)
+    init_line_structures (_rl_screenwidth + 1);
 
   /* Draw the line into the buffer. */
   cpos_buffer_position = -1;
@@ -2374,7 +2379,7 @@ insert_some_chars (string, count, col)
      char *string;
      int count, col;
 {
-#if defined (__MSDOS__) || defined (__MINGW32__)
+#if defined (__MSDOS__) || (defined (__MINGW32__) && !defined (NCURSES_VERSION))
   _rl_output_some_chars (string, count);
 #else
   /* DEBUGGING */
@@ -2426,7 +2431,7 @@ delete_chars (count)
   if (count > _rl_screenwidth) /* XXX */
     return;
 
-#if !defined (__MSDOS__) && !defined (__MINGW32__)
+#if !defined (__MSDOS__) && !(defined (__MINGW32__) && !defined (NCURSES_VERSION))
   if (_rl_term_DC && *_rl_term_DC)
     {
       char *buffer;
This page took 0.024662 seconds and 4 git commands to generate.