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;
                }
            }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to