Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 May 2009 17:26:01 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
Subject:   svn commit: r191786 - stable/6/lib/libstand
Message-ID:  <200905041726.n44HQ12l051599@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Mon May  4 17:26:01 2009
New Revision: 191786
URL: http://svn.freebsd.org/changeset/base/191786

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

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

Modified: stable/6/lib/libstand/gets.c
==============================================================================
--- stable/6/lib/libstand/gets.c	Mon May  4 17:25:53 2009	(r191785)
+++ stable/6/lib/libstand/gets.c	Mon May  4 17:26:01 2009	(r191786)
@@ -78,7 +78,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);
 	    }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905041726.n44HQ12l051599>