Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2016 16:09:05 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303482 - head/usr.bin/indent
Message-ID:  <201607291609.u6TG95BG057064@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Fri Jul 29 16:09:05 2016
New Revision: 303482
URL: https://svnweb.freebsd.org/changeset/base/303482

Log:
  indent(1): Avoid out of bound access of array codebuf.
  
  dump_line() requires s_code to be a string, because it will call count_spaces().
  
  Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
  Obtained from:	Piotr Stefaniak

Modified:
  head/usr.bin/indent/indent.c

Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c	Fri Jul 29 15:24:50 2016	(r303481)
+++ head/usr.bin/indent/indent.c	Fri Jul 29 16:09:05 2016	(r303482)
@@ -979,8 +979,10 @@ check_type:
 		    if (ps.want_blank)
 			*e_code++ = ' ';
 		    ps.want_blank = false;
-		    if (dec_ind && s_code != e_code)
+		    if (dec_ind && s_code != e_code) {
+			*e_code = '\0';
 			dump_line();
+		    }
 		    dec_ind = 0;
 		}
 	    }



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