summaryrefslogtreecommitdiff
path: root/usr.bin/dtc
diff options
context:
space:
mode:
authorDavid Chisnall <theraven@FreeBSD.org>2013-07-10 10:57:09 +0000
committerDavid Chisnall <theraven@FreeBSD.org>2013-07-10 10:57:09 +0000
commit3334a61716e4e5f85260ecdfc4932b773d3be57e (patch)
tree91ca077a30e1b8ddd9873a819f71554e7df2baab /usr.bin/dtc
parent19ca1aa0d4476cb6a02a176bebbf859f77edb778 (diff)
downloadsrc-test-3334a61716e4e5f85260ecdfc4932b773d3be57e.tar.gz
src-test-3334a61716e4e5f85260ecdfc4932b773d3be57e.zip
Report error for out-of-range numerical inputs. Requested by brooks.
Notes
Notes: svn path=/head/; revision=253149
Diffstat (limited to 'usr.bin/dtc')
-rw-r--r--usr.bin/dtc/fdt.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/dtc/fdt.cc b/usr.bin/dtc/fdt.cc
index b6e7d56d7e440..6f27c9cb0b5f9 100644
--- a/usr.bin/dtc/fdt.cc
+++ b/usr.bin/dtc/fdt.cc
@@ -30,6 +30,8 @@
* $FreeBSD$
*/
+#define __STDC_LIMIT_MACROS 1
+
#include "fdt.hh"
#include <algorithm>
@@ -281,6 +283,12 @@ property::parse_cells(input_buffer &input)
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();
}