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
This commit is contained in:
Pedro F. Giffuni 2016-07-29 16:09:05 +00:00
parent 6c99513703
commit 19fe172ace
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=303482

View File

@ -979,8 +979,10 @@ main(int argc, char **argv)
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;
}
}