svn commit: r191785 - stable/7/lib/libstand

John Baldwin jhb at FreeBSD.org
Mon May 4 17:25:54 UTC 2009


Author: jhb
Date: Mon May  4 17:25:53 2009
New Revision: 191785
URL: http://svn.freebsd.org/changeset/base/191785

Log:
  MFC: Fix an off-by-one buffer overflow in ngets().

Modified:
  stable/7/lib/libstand/   (props changed)
  stable/7/lib/libstand/gets.c

Modified: stable/7/lib/libstand/gets.c
==============================================================================
--- stable/7/lib/libstand/gets.c	Mon May  4 16:10:37 2009	(r191784)
+++ stable/7/lib/libstand/gets.c	Mon May  4 17:25:53 2009	(r191785)
@@ -74,7 +74,7 @@ ngets(char *buf, int n)
 	    putchar('\n');
 	    break;
 	default:
-	    if ((n < 1) || ((lp - buf) < n)) {
+	    if ((n < 1) || ((lp - buf) < n - 1)) {
 		*lp++ = c;
 		putchar(c);
 	    }


More information about the svn-src-stable-7 mailing list