Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Jan 2012 22:46:18 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r230118 - head/bin/sh
Message-ID:  <201201142246.q0EMkI6P052011@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sat Jan 14 22:46:18 2012
New Revision: 230118
URL: http://svn.freebsd.org/changeset/base/230118

Log:
  sh: Change input buffer size from 1023 to 1024.
  
  PR:		bin/161756

Modified:
  head/bin/sh/input.c

Modified: head/bin/sh/input.c
==============================================================================
--- head/bin/sh/input.c	Sat Jan 14 21:54:12 2012	(r230117)
+++ head/bin/sh/input.c	Sat Jan 14 22:46:18 2012	(r230118)
@@ -97,7 +97,7 @@ int parsenleft;			/* copy of parsefile->
 MKINIT int parselleft;		/* copy of parsefile->lleft */
 char *parsenextc;		/* copy of parsefile->nextc */
 MKINIT struct parsefile basepf;	/* top level input file */
-char basebuf[BUFSIZ];		/* buffer for top level input file */
+char basebuf[BUFSIZ + 1];	/* buffer for top level input file */
 static struct parsefile *parsefile = &basepf;	/* current input file */
 int init_editline = 0;		/* editline library initialized? */
 int whichprompt;		/* 1 == PS1, 2 == PS2 */
@@ -189,8 +189,8 @@ retry:
 			nr = 0;
 		else {
 			nr = el_len;
-			if (nr > BUFSIZ - 1)
-				nr = BUFSIZ - 1;
+			if (nr > BUFSIZ)
+				nr = BUFSIZ;
 			memcpy(parsenextc, rl_cp, nr);
 			if (nr != el_len) {
 				el_len -= nr;
@@ -200,7 +200,7 @@ retry:
 		}
 	} else
 #endif
-		nr = read(parsefile->fd, parsenextc, BUFSIZ - 1);
+		nr = read(parsefile->fd, parsenextc, BUFSIZ);
 
 	if (nr <= 0) {
                 if (nr < 0) {
@@ -428,13 +428,13 @@ setinputfd(int fd, int push)
 	(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
 	if (push) {
 		pushfile();
-		parsefile->buf = ckmalloc(BUFSIZ);
+		parsefile->buf = ckmalloc(BUFSIZ + 1);
 	}
 	if (parsefile->fd > 0)
 		close(parsefile->fd);
 	parsefile->fd = fd;
 	if (parsefile->buf == NULL)
-		parsefile->buf = ckmalloc(BUFSIZ);
+		parsefile->buf = ckmalloc(BUFSIZ + 1);
 	parselleft = parsenleft = 0;
 	plinno = 1;
 }



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