svn commit: r241074 - stable/9/lib/libedit

Kevin Lo kevlo at FreeBSD.org
Sun Sep 30 16:11:51 UTC 2012


Author: kevlo
Date: Sun Sep 30 16:11:50 2012
New Revision: 241074
URL: http://svn.freebsd.org/changeset/base/241074

Log:
  MFC r240982:
  Initialize the num variable to avoid uninitialized data.
  This fixes the bug introduced by r238378.
  
  Reviewed by:	pfg

Modified:
  stable/9/lib/libedit/read.c
Directory Properties:
  stable/9/lib/libedit/   (props changed)

Modified: stable/9/lib/libedit/read.c
==============================================================================
--- stable/9/lib/libedit/read.c	Sun Sep 30 15:42:20 2012	(r241073)
+++ stable/9/lib/libedit/read.c	Sun Sep 30 16:11:50 2012	(r241074)
@@ -426,7 +426,7 @@ el_gets(EditLine *el, int *nread)
 		char *cp = el->el_line.buffer;
 		size_t idx;
 
-		while ((*el->el_read.read_char)(el, cp) == 1) {
+		while ((num = (*el->el_read.read_char)(el, cp)) == 1) {
 			/* make sure there is space for next character */
 			if (cp + 1 >= el->el_line.limit) {
 				idx = (cp - el->el_line.buffer);
@@ -479,7 +479,7 @@ el_gets(EditLine *el, int *nread)
 
 		term__flush(el);
 
-		while ((*el->el_read.read_char)(el, cp) == 1) {
+		while ((num = (*el->el_read.read_char)(el, cp)) == 1) {
 			/* make sure there is space next character */
 			if (cp + 1 >= el->el_line.limit) {
 				idx = (cp - el->el_line.buffer);


More information about the svn-src-all mailing list