Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2016 16:14:03 +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: r303483 - head/usr.bin/indent
Message-ID:  <201607291614.u6TGE35m060511@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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; \
 	}



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