svn commit: r303483 - head/usr.bin/indent
Pedro F. Giffuni
pfg at FreeBSD.org
Fri Jul 29 16:14:04 UTC 2016
Author: pfg
Date: Fri Jul 29 16:14:03 2016
New Revision: 303483
URL: https://svnweb.freebsd.org/changeset/base/303483
Log:
indent(1): Avoid potential use-after-free.
last_bl is a char pointer that tracks the last blank character in a
comment, which is used for wrapping long comment lines. Since the
underlying array may be reallocated, make sure last_bl is up to date when
that happens.
Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from: Piotr Stefaniak
Modified:
head/usr.bin/indent/indent_globs.h
Modified: head/usr.bin/indent/indent_globs.h
==============================================================================
--- head/usr.bin/indent/indent_globs.h Fri Jul 29 16:09:05 2016 (r303482)
+++ head/usr.bin/indent/indent_globs.h Fri Jul 29 16:14:03 2016 (r303483)
@@ -71,6 +71,7 @@ FILE *output; /* the output file
if (combuf == NULL) \
err(1, NULL); \
e_com = combuf + (e_com-s_com) + 1; \
+ last_bl = combuf + (last_bl-s_com) + 1; \
l_com = combuf + nsize - 5; \
s_com = combuf + 1; \
}
More information about the svn-src-all
mailing list