diff --git a/usr.bin/dtc/fdt.cc b/usr.bin/dtc/fdt.cc index b6e7d56d7e4..6f27c9cb0b5 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 @@ -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(); }