svn commit: r253149 - head/usr.bin/dtc

David Chisnall theraven at FreeBSD.org
Wed Jul 10 10:57:09 UTC 2013


Author: theraven
Date: Wed Jul 10 10:57:09 2013
New Revision: 253149
URL: http://svnweb.freebsd.org/changeset/base/253149

Log:
  Report error for out-of-range numerical inputs.  Requested by brooks.

Modified:
  head/usr.bin/dtc/fdt.cc

Modified: head/usr.bin/dtc/fdt.cc
==============================================================================
--- head/usr.bin/dtc/fdt.cc	Wed Jul 10 10:51:12 2013	(r253148)
+++ head/usr.bin/dtc/fdt.cc	Wed Jul 10 10:57:09 2013	(r253149)
@@ -30,6 +30,8 @@
  * $FreeBSD$
  */
 
+#define __STDC_LIMIT_MACROS 1
+
 #include "fdt.hh"
 
 #include <algorithm>
@@ -281,6 +283,12 @@ property::parse_cells(input_buffer &inpu
 				valid = false;
 				return;
 			}
+			if ((val < 0) || (val > UINT32_MAX))
+			{
+				input.parse_error("Value out of range");
+				valid = false;
+				return;
+			}
 			push_big_endian(v.byte_data, (uint32_t)val);
 			input.next_token();
 		}


More information about the svn-src-all mailing list