diff -r 05a4f72afa27 mingwex/stdio/getline.c
--- a/mingwex/stdio/getline.c	Sun Feb 19 19:33:22 2012 +0000
+++ b/mingwex/stdio/getline.c	Sat Feb 25 22:17:03 2012 +0000
@@ -29,6 +29,7 @@
  */
 #include <stdio.h>
 #include <stdlib.h>
+#include <limits.h>
 #include <errno.h>
 
 #undef EXTERN_C
@@ -91,6 +92,16 @@
    */
   while( (nextchar != brk) && ((nextchar = fgetc( stream )) != EOF) )
   {
+    /* The maximum count value we can return is SSIZE_MAX; if we've
+     * already accumulated that many, then the current character will
+     * cause an overflow...
+     */
+    if( count == SSIZE_MAX )
+      /*
+       * ...so bail out.
+       */
+      return getline_abort( EOVERFLOW );
+
     /* We will store the resultant string into the buffer located at
      * the address pointed to by *linebuf; this MUST be a dynamically
      * allocated buffer of size as specified by *len.  Before we add